Я пытаюсь отправить мутацию GraphQL и получаю синтаксическую ошибку, которую не могу понять.Я видел, что была ошибка, касающаяся экранированных / неэкранированных персонажей.Я пытался избежать, двойные кавычки, одинарные кавычки, без кавычек.Кажется, я не могу обойти эту проблему.Трассировка по коду.
# http headers for api call
headers = {
'accept': "application/json",
'content-type':"application/json",
'authorization': "bearer " + token,
}
# create inventory variable for mutation
# will convert the csv to the json input in production
inventory:[{"supplier_id":24522,"supplier_part_number":"1-1002-9-SN","quantity_on_hand":5,"item_next_availability_date":"05-01-2018T00:00:00", "discontinued":true}]
# payload of the json query to pass to the API
#GraphQL Query to pull in Purchase Order Data
payload = '''
{"query":"mutation save_inventory($inventory: [inventoryInput]!) {
inventory {
save(inventory: $inventory, dry_run: true) {
handle
}
}
}"}
'''
# send API call and assign response to variable
response = requests.post(api_url, data=payload, headers=headers)
Ошибка, которую я не могу понять ниже.
{"errors":[{"message":"Syntax Error GraphQL (1:1) Unexpected <EOF>\n\n1: \n ^\n","category":"graphql","locations":[{"l
ine":1,"column":1}]}]}