Apply header to all client requests


I am writing a script in python and need help ensuring all of my requests have the header “accept”: “application/json” - otherwise their format comes with parenthesis on either end and other non-json formatting which prevents me using json.loads(). I do need to import this as a dictionary to find relevant information json.dumps() will not work (str)

I am currently importing the asana module and am uncertain where to add this- here is my current unsuccessful attempt:

client = asana.Client.access_token(personal_access_token)
client.headers= {“accept”: “application/json”}

in my script I am calling get_task as follows and receiving the bad formatting

def get_task(gid):
task = client.tasks.get_task(gid),{ ‘opt_fields’: “gid, name, custom_fields”}
return str(task)