Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug 1 #379

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions shared/torngit/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ async def make_http_call(
statuses_to_retry=[502, 503, 504],
**args,
) -> Response:
print("ALRIGHT 10")
print("token to use", token_to_use)
_headers = {
"Accept": "application/json",
"User-Agent": os.getenv("USER_AGENT", "Default"),
Expand All @@ -774,13 +776,15 @@ async def make_http_call(
log_dict = {}

method = (method or "GET").upper()

if url[0] == "/":
log_dict = dict(
event="api",
endpoint=url,
method=method,
bot=token_to_use.get("username"),
repo_slug=self.slug,
# loggable_token=token_to_use,
loggable_token=self.loggable_token(token_to_use),
)
url = self.api_url + url
Expand All @@ -792,16 +796,29 @@ 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"
# del _headers["User-Agent"]

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):
retry_reason = "retriable_status"
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")
Expand Down
Loading