Skip to content

Commit 602eaaf

Browse files
authored
Fetch 20 categories (#8)
* Fetch 20 categories * 20 -> 25 * Print graphql response * 25 -> 50
1 parent 265e48e commit 602eaaf

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/github_services.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ def _get_repository_id(
235235
)
236236
data = response.json()
237237

238+
print('--- GraphQL response ---')
239+
print('Repository id')
240+
print(data)
241+
238242
repository_id: str = (
239243
data['data']['repository']['id'])
240244

@@ -258,7 +262,7 @@ def _get_category_id(
258262
query = """
259263
query ($org_name: String!, $repository: String!) {
260264
repository(owner: $org_name, name: $repository) {
261-
discussionCategories(first: 10) {
265+
discussionCategories(first: 50) {
262266
nodes {
263267
id
264268
name
@@ -280,6 +284,9 @@ def _get_category_id(
280284
timeout=TIMEOUT_SECS
281285
)
282286
data = response.json()
287+
print('--- GraphQL response ---')
288+
print('Discussion category names and ids')
289+
print(data)
283290

284291
category_id: Optional[str] = None
285292
discussion_categories = (
@@ -341,6 +348,9 @@ def _get_discussion_ids(
341348
timeout=TIMEOUT_SECS
342349
)
343350
data = response.json()
351+
print('--- GraphQL response ---')
352+
print('Discussion ids, titles, numbers')
353+
print(data)
344354

345355
discussions = data['data']['repository']['discussions']['nodes']
346356
discussion_ids = [
@@ -377,6 +387,9 @@ def _delete_discussion(discussion_id: str) -> None:
377387
headers=_get_request_headers(),
378388
timeout=TIMEOUT_SECS
379389
)
390+
print('--- GraphQL response ---')
391+
print('Delete discussion')
392+
print(response)
380393
response.raise_for_status()
381394

382395

@@ -429,5 +442,8 @@ def create_discussion(
429442
headers=_get_request_headers(),
430443
timeout=TIMEOUT_SECS
431444
)
445+
print('--- GraphQL response ---')
446+
print('Create discussion')
447+
print(response)
432448

433449
response.raise_for_status()

0 commit comments

Comments
 (0)