質問編集履歴

2

修正

2022/09/05 10:13

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- GraphQLをPOSTで取得した
1
+ GraphQLにつ
test CHANGED
@@ -9,30 +9,3 @@
9
9
  参考にしたサイト:
10
10
  https://zenn.dev/msksgm/articles/shopify-api-python-request-graphql
11
11
 
12
- ```python
13
- # coding: utf-8
14
- import json
15
- import requests
16
-
17
- query = """{
18
- TestQuery($test_id: Int!) {
19
- container: testById(id: $test_id) {
20
- id
21
- name
22
- }
23
- }
24
- }"""
25
-
26
- variables = {"test_id": 1}
27
-
28
- headers = {
29
- "Content-Type": "application/json",
30
- }
31
-
32
- res = requests.post("http://localhost/graphql",
33
- headers=headers,
34
- json={"query": query, "variables": variables},
35
- )
36
-
37
- ```
38
-

1

修正

2022/07/25 08:43

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -14,8 +14,6 @@
14
14
  import json
15
15
  import requests
16
16
 
17
- url = "http://localhost/graphql"
18
-
19
17
  query = """{
20
18
  TestQuery($test_id: Int!) {
21
19
  container: testById(id: $test_id) {
@@ -31,7 +29,7 @@
31
29
  "Content-Type": "application/json",
32
30
  }
33
31
 
34
- res = requests.post(url,
32
+ res = requests.post("http://localhost/graphql",
35
33
  headers=headers,
36
34
  json={"query": query, "variables": variables},
37
35
  )