Skip to content

Commit 8ecd1d1

Browse files
committed
Fix reading query
1 parent f717565 commit 8ecd1d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/graphql.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
URL = "https://api.github.com/graphql"
1313

14+
base_dir = pathlib.Path(sys.argv[1])
15+
1416
with open("/etc/config.json", encoding="utf-8") as jsonfile:
1517
config = json.load(jsonfile)
1618

17-
with open("assets/graphql_query.txt", encoding="utf-8") as queryfile:
19+
with open(base_dir / "assets/graphql_query.txt", encoding="utf-8") as queryfile:
1820
query_param = {"query": queryfile.read()}
1921

2022
resp = requests.post(
@@ -27,13 +29,12 @@
2729
)
2830

2931
json_resp = json.loads(resp.content)["data"]["user"]
30-
base_dir = pathlib.Path(sys.argv[1])
3132
resp_dir = base_dir / "assets/contrib/"
3233
card_dir = base_dir / "flask_app/static/img/gh_cards/"
3334
resp_dir.mkdir(exist_ok=True)
3435
card_dir.mkdir(exist_ok=True)
3536

36-
with open(str(resp_dir / "recent.json"), mode="w", encoding="utf-8") as contribfile:
37+
with open(resp_dir / "recent.json", mode="w", encoding="utf-8") as contribfile:
3738
json.dump(json_resp, contribfile)
3839

3940

0 commit comments

Comments
 (0)