From df4141ec28368507fbf71cb89e8ab334522e3fc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7oise=20Conil?= <francoise.conil@insa-lyon.fr>
Date: Thu, 4 Jul 2024 12:05:02 +0200
Subject: [PATCH] Naive curl requests to retrieve all issues

I made a first request to get the number of pages then several curl
requests.

Unfortunately there were duplicates issues.

There may be some headers to catch and reuse but I do not know which
ones.

GitHub strongly insists on using their CLI (gh) to acccess the API.
---
 curl/get-all-pypi-issues_curl.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100755 curl/get-all-pypi-issues_curl.sh

diff --git a/curl/get-all-pypi-issues_curl.sh b/curl/get-all-pypi-issues_curl.sh
new file mode 100755
index 0000000..7fd6c44
--- /dev/null
+++ b/curl/get-all-pypi-issues_curl.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# https://blog.exploratory.io/analyzing-issue-data-with-github-rest-api-63945017dedc
+# (state = "all", per_page = 100, page = i
+#    -o pypi-issues_31-05-2024.${page}.json \
+
+# Ou plus simplement dans la doc de l'API GitHub
+# https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues
+
+seq -w 1 42 | while read page
+do
+    curl -s -L -H "Accept: application/vnd.github+json" \
+        -H "Authorization: Bearer ${MY_PYPI_ISSUES_TOKEN}" \
+        -H "X-GitHub-Api-Version: 2022-11-28" \
+        -o pypi_issues.${page}.json \
+        "https://api.github.com/repos/pypi/support/issues?state=all&per_page=100&page=${page}"
+done
-- 
GitLab