payload = """ query GetOrders($num_els: Int, $created_at: String, $cursor: String) {
orders(first: $num_els, query: $created_at, after: $cursor) {
edges {
node{
email
}
}
}
}"""
I try to send a simple query. The $cursor
field can be empty.
variables = {'num_els': num_elements, 'created_at': f'created_at:>2022-01-10', 'cursor': None}
r = requests.post(constants['SHOPIFY_URL'], headers=headers,
json={'query': payload, 'variables': variables}).json()
However this gives me the
[{'message': 'Parse error on "query" (STRING) at [1, 2]', 'locations': [{'line': 1, 'column': 2}]}]
Even if I discard the a bit complicated part with $created_at
, the problem continues. Do you have any suggestions?
changing Content-Type
to application/json
worked as denoted here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.