Python code generated by Insomnia GraphQL client reacts not as expected - Problems with UTF-8
- Dominant language
- TypeScript
- Stars
- 40k
- Forks
- 2.4k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
I've an issue with the python code generated by Insomnia with submitting GraphQL queries to Shopify with Umlauts. When using the Insomnia client the query is executed as expected

When using the insomnia generated code with Python 3.x on Mac (tried both command line execution as well as Jupyter), the Umlaut doesn't get displayed correctly:
Here's the Python code:
```
import requests
url = "https://langerchen.myshopify.com/admin/api/2020-07/graphql.json"
payload = "{\"query\":\"mutation($input: ProductInput!) {\\n productUpdate(input: $input)
{\\n product {\\n metafields(first: 100) {\\n edges {\\n node {\\n
id\\n namespace\\n key\\n value\\n }\\n
}\\n }\\n }\\n }\\n} \",\"variables\":{\"input\":
{\"id\":\"gid://shopify/Product/5438127669399\",\"metafields\":[{\"namespace\":\"product-
details\",\"key\":\"Style\",\"value\":\"This should display a umlaut:
Ü\",\"valueType\":\"STRING\"}]}}}"
headers = {
'cookie': "_secure_admin_session_id=xxx;
_secure_admin_session_id_csrf=xxx; request_method=POST;
__cfduid=xxx",
'x-shopify-access-token': "shppa_xxx",
'content-type': "application/json"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
```
The response:
```
{"data":{"productUpdate":{"product":{"metafields":{"edges":[{"node":
{"id":"gid:\/\/shopify\/Metafield\/14509735084183","namespace":"product-
details","key":"Style","value":"This should display a umlaut: Ü"}},{"node":
{"id":"gid:\/\/shopify\/Metafield\/14509782761623","namespace":"product-
details","key":"Kurzbeschreibung","value":"This should display a umlaut:
�"}}]}}}},"extensions":{"cost":
{"requestedQueryCost":112,"actualQueryCost":14,"throttleStatus":
{"maximumAvailable":1000.0,"currentlyAvailable":986,"restoreRate":50.0}}}}
```
I am also including the Screenshot of Shopify displaying both cases, Python on the left, Insomnia on the right.

Stackoverflow post for this issue: https://stackoverflow.com/questions/63141535/python-code-generated-by-insomnia-graphql-client-reacts-not-as-expected
[1]: https://i.stack.imgur.com/VAYj9.png
Contributor guide
Research direction
Start by reproducing the issue with the generated Python 3.x script shown in the report, using its requests.request POST call and the Shopify GraphQL payload containing Ü. Compare the generated request and response with the Insomnia client; done means the submitted and returned umlaut text is preserved correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, python
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100