Skip to content
Snippets Groups Projects
Unverified Commit 76e07daa authored by Max Gautier's avatar Max Gautier
Browse files

download: put grapqQL query in package + read from importlib

parent a551922c
Branches
Tags
No related merge requests found
[build-system] [build-system]
requires = ["setuptools >= 61.0"] requires = ["setuptools >= 61.0",
"setuptools_scm >= 8.0",
]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[project] [project]
......
...@@ -17,6 +17,7 @@ import hashlib ...@@ -17,6 +17,7 @@ import hashlib
from datetime import datetime from datetime import datetime
from ruamel.yaml import YAML from ruamel.yaml import YAML
from packaging.version import Version, InvalidVersion from packaging.version import Version, InvalidVersion
from importlib.resources import files
from typing import Optional from typing import Optional
...@@ -204,9 +205,9 @@ def download_hash(only_downloads: [str]) -> None: ...@@ -204,9 +205,9 @@ def download_hash(only_downloads: [str]) -> None:
'repoWithReleases': [r['graphql_id'] for r in releases.values()], 'repoWithReleases': [r['graphql_id'] for r in releases.values()],
'repoWithTags': [t['graphql_id'] for t in tags.values()], 'repoWithTags': [t['graphql_id'] for t in tags.values()],
} }
with open("list_releases.graphql") as query:
response = s.post("https://api.github.com/graphql", response = s.post("https://api.github.com/graphql",
json={'query': query.read(), 'variables': ql_params}, json={'query': files(__package__).joinpath('list_releases.graphql').read_text(),
'variables': ql_params},
headers={ headers={
"Authorization": f"Bearer {os.environ['API_KEY']}", "Authorization": f"Bearer {os.environ['API_KEY']}",
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment