From 67aed6811afeebd7d484fbffcf8605041ead0d47 Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 09:53:45 -0400 Subject: [PATCH 01/11] debug 1 --- shared/torngit/github.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index 4a66384ad..a1b0de33a 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,6 +764,7 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: + print("ALRIGHT 1") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), @@ -781,7 +782,7 @@ async def make_http_call( method=method, bot=token_to_use.get("username"), repo_slug=self.slug, - loggable_token=self.loggable_token(token_to_use), + loggable_token=token_to_use, ) url = self.api_url + url @@ -795,6 +796,11 @@ async def make_http_call( kwargs = dict( json=body if body else None, headers=_headers, follow_redirects=False ) + + print("kwargs", kwargs) + print("URL", url) + print("method", method) + max_number_retries = 3 tried_refresh = False for current_retry in range(1, max_number_retries + 1): From 9b1648ba95fb03507638caa049edfa7c03368dbf Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 10:00:19 -0400 Subject: [PATCH 02/11] debug 2 --- shared/torngit/github.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index a1b0de33a..e7c025050 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,7 +764,7 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 1") + print("ALRIGHT 2") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), @@ -793,6 +793,10 @@ async def make_http_call( elif url.startswith(self.service_url) and self.host_header is not None: _headers["Host"] = self.host_header + + _headers["X-GitHub-Api-Version"] = "2022-11-28" + _headers["Accept"] = "application/vnd.github+json" + kwargs = dict( json=body if body else None, headers=_headers, follow_redirects=False ) From a44d85206be86b148b9f9a4459d199068e6173c4 Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 10:06:52 -0400 Subject: [PATCH 03/11] debug 3 --- shared/torngit/github.py | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index e7c025050..8863b9aea 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -796,6 +796,7 @@ async def make_http_call( _headers["X-GitHub-Api-Version"] = "2022-11-28" _headers["Accept"] = "application/vnd.github+json" + del _headers["User-Agent"] kwargs = dict( json=body if body else None, headers=_headers, follow_redirects=False From 12a4ed26e3022a4c569daf4a796bbf2e50060000 Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 10:11:55 -0400 Subject: [PATCH 04/11] debug 4 --- shared/torngit/github.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index 8863b9aea..291bf1bb4 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,13 +764,13 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 2") + print("ALRIGHT 3") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), } if token_to_use: - _headers["Authorization"] = "token %s" % token_to_use["key"] + _headers["Authorization"] = "Bearer %s" % token_to_use["key"] _headers.update(headers or {}) log_dict = {} From ecd330ba71ab9b6b4bc5b79ad439d84c456acc24 Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 10:21:18 -0400 Subject: [PATCH 05/11] debug 5 --- shared/torngit/github.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index 291bf1bb4..492752376 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,7 +764,7 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 3") + print("ALRIGHT 4") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), @@ -813,6 +813,9 @@ async def make_http_call( try: with metrics.timer(f"{METRICS_PREFIX}.api.run") as timer: res = await client.request(method, url, **kwargs) + + print("what is res", res) + if current_retry > 1: # count retries without getting a url self.count_and_get_url_template(url_name="make_http_call_retry") From 5d79548f7f04ad2250d13db80e5fe1a14e82ef1a Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 10:46:01 -0400 Subject: [PATCH 06/11] debug 6 --- shared/torngit/github.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index 492752376..95b97ad02 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,17 +764,20 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 4") + print("ALRIGHT 6") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), } if token_to_use: - _headers["Authorization"] = "Bearer %s" % token_to_use["key"] + _headers["Authorization"] = "token %s" % token_to_use["key"] _headers.update(headers or {}) log_dict = {} method = (method or "GET").upper() + + url = "/repos/JerrySentry/LocalDevPrivate/commits" + if url[0] == "/": log_dict = dict( event="api", @@ -794,9 +797,9 @@ async def make_http_call( _headers["Host"] = self.host_header - _headers["X-GitHub-Api-Version"] = "2022-11-28" - _headers["Accept"] = "application/vnd.github+json" - del _headers["User-Agent"] + # _headers["X-GitHub-Api-Version"] = "2022-11-28" + # _headers["Accept"] = "application/vnd.github+json" + # del _headers["User-Agent"] kwargs = dict( json=body if body else None, headers=_headers, follow_redirects=False From e2a628153de7a3a977283be1648e36925365aeec Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 12:52:52 -0400 Subject: [PATCH 07/11] debug 7 --- shared/torngit/github.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index 95b97ad02..a53e0179d 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,7 +764,7 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 6") + print("ALRIGHT 7") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), @@ -776,7 +776,7 @@ async def make_http_call( method = (method or "GET").upper() - url = "/repos/JerrySentry/LocalDevPrivate/commits" + url = "/repos/JerrySentry/LocalDev/commits" if url[0] == "/": log_dict = dict( From 822a87b94f645e229c3667ef90a9a42f27f5b7ce Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 13:04:12 -0400 Subject: [PATCH 08/11] debug 8 --- shared/torngit/github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index a53e0179d..bddf82f46 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -776,7 +776,7 @@ async def make_http_call( method = (method or "GET").upper() - url = "/repos/JerrySentry/LocalDev/commits" + url = "/repos/JerrySentry/LocalDevPrivate/commits" if url[0] == "/": log_dict = dict( From fd5a4475f8d0572d38bb6f4e39107ea8359b9bc5 Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Thu, 3 Oct 2024 13:10:35 -0400 Subject: [PATCH 09/11] debug 9 --- shared/torngit/github.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index bddf82f46..ba38ac9b3 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,7 +764,7 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 7") + print("ALRIGHT 8") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), @@ -776,8 +776,6 @@ async def make_http_call( method = (method or "GET").upper() - url = "/repos/JerrySentry/LocalDevPrivate/commits" - if url[0] == "/": log_dict = dict( event="api", From 99727bd13366bd95a3bacf447d09084d34405764 Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Fri, 4 Oct 2024 10:46:17 -0400 Subject: [PATCH 10/11] debug 10 --- shared/torngit/github.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index ba38ac9b3..047695fbc 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,7 +764,7 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 8") + print("ALRIGHT 9") _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"), @@ -783,7 +783,8 @@ async def make_http_call( method=method, bot=token_to_use.get("username"), repo_slug=self.slug, - loggable_token=token_to_use, + # loggable_token=token_to_use, + loggable_token=self.loggable_token(token_to_use), ) url = self.api_url + url From 9281b5c21ed7bdf552ff7880b66e177cf1f1afd8 Mon Sep 17 00:00:00 2001 From: JerrySentry Date: Fri, 4 Oct 2024 10:51:07 -0400 Subject: [PATCH 11/11] debug 11 --- shared/torngit/github.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/torngit/github.py b/shared/torngit/github.py index 047695fbc..89a6f6c30 100644 --- a/shared/torngit/github.py +++ b/shared/torngit/github.py @@ -764,7 +764,8 @@ async def make_http_call( statuses_to_retry=[502, 503, 504], **args, ) -> Response: - print("ALRIGHT 9") + print("ALRIGHT 10") + print("token to use", token_to_use) _headers = { "Accept": "application/json", "User-Agent": os.getenv("USER_AGENT", "Default"),