我正在尝试发布一个 GraphQL Mutation 并且遇到了一个我无法弄清楚的语法错误。我看到有一个关于转义/非转义字符的错误。我试过转义,双引号,单引号,没有引号。我似乎无法解决这个问题。代码下的回溯。# http headers for api callheaders = { 'accept': "application/json", 'content-type':"application/json", 'authorization': "bearer " + token,}# create inventory variable for mutation # will convert the csv to the json input in productioninventory:[{"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 variableresponse = 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}]}]}
添加回答
举报
0/150
提交
取消