From 1e5dd2923c720e0ac13a68af00c5e379bb16be7a Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 26 Oct 2022 15:47:06 -0600 Subject: [PATCH 1/4] fix: bug with listing repositories --- github_deploy/commands/_http_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_deploy/commands/_http_utils.py b/github_deploy/commands/_http_utils.py index d736fe7..2cb9ae2 100644 --- a/github_deploy/commands/_http_utils.py +++ b/github_deploy/commands/_http_utils.py @@ -55,8 +55,8 @@ async def delete(*, session, url, data, headers=None): async def list_repos(*, session, org, token): headers = { - "Authorization": "token {token}".format(token=token), - "Accept": "application/vnd.github.v3+json", + "Authorization": "Bearer {token}".format(token=token), + "Accept": "application/vnd.github+json", } url = REPOS_URL.format(org=org) click.echo("Retrieving repos at {}".format(url)) From c9c934b3438af459f6a27b14072050f5c177c16d Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 26 Oct 2022 15:52:19 -0600 Subject: [PATCH 2/4] Update delete.py --- github_deploy/commands/delete.py | 46 +------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/github_deploy/commands/delete.py b/github_deploy/commands/delete.py index 8ead88e..11742df 100644 --- a/github_deploy/commands/delete.py +++ b/github_deploy/commands/delete.py @@ -5,51 +5,7 @@ from github_deploy.commands._constants import BASE_URL from github_deploy.commands._http_utils import delete, get, list_repos -from github_deploy.commands._utils import get_repo - - -async def delete_content( - *, - session, - repo, - dest, - token, - semaphore, - exists, - current_sha, -): - headers = { - "Authorization": "token {token}".format(token=token), - "Accept": "application/vnd.github.v3+json", - } - - data = {"message": "Deleted {}".format(dest)} - if exists: - data["sha"] = current_sha - - url = BASE_URL.format(repo=repo, path=dest) - - async with semaphore: - response = await delete( - session=session, url=url, data=data, headers=headers - ) - - return response - - -async def check_exists(*, session, repo, dest, token, semaphore, skip_missing): - headers = {"Authorization": "token {token}".format(token=token)} - url = BASE_URL.format(repo=repo, path=dest) - - async with semaphore: - response = await get( - session=session, - url=url, - headers=headers, - skip_missing=skip_missing, - ) - - return response +from github_deploy.commands._utils import get_repo, delete_contents, check_exists async def handle_file_delete(*, repo, dest, token, semaphore, session): From a0e1ffd7058bc221e174feaf17bc3c58e6784f74 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 26 Oct 2022 15:52:58 -0600 Subject: [PATCH 3/4] Update delete.py --- github_deploy/commands/delete.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_deploy/commands/delete.py b/github_deploy/commands/delete.py index 11742df..d3c2d50 100644 --- a/github_deploy/commands/delete.py +++ b/github_deploy/commands/delete.py @@ -4,8 +4,8 @@ import asyncclick as click from github_deploy.commands._constants import BASE_URL -from github_deploy.commands._http_utils import delete, get, list_repos -from github_deploy.commands._utils import get_repo, delete_contents, check_exists +from github_deploy.commands._http_utils import delete, get, list_repos, delete_contents, check_exists +from github_deploy.commands._utils import get_repo async def handle_file_delete(*, repo, dest, token, semaphore, session): From d8700bac284d6181abf95e72719ea04543eb1556 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 26 Oct 2022 15:54:17 -0600 Subject: [PATCH 4/4] Update _http_utils.py --- github_deploy/commands/_http_utils.py | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/github_deploy/commands/_http_utils.py b/github_deploy/commands/_http_utils.py index 2cb9ae2..0dd699d 100644 --- a/github_deploy/commands/_http_utils.py +++ b/github_deploy/commands/_http_utils.py @@ -62,3 +62,47 @@ async def list_repos(*, session, org, token): click.echo("Retrieving repos at {}".format(url)) response = await get(session=session, url=url, headers=headers) return response + + +async def delete_content( + *, + session, + repo, + dest, + token, + semaphore, + exists, + current_sha, +): + headers = { + "Authorization": "Bearer {token}".format(token=token), + "Accept": "application/vnd.github+json", + } + + data = {"message": "Deleted {}".format(dest)} + if exists: + data["sha"] = current_sha + + url = BASE_URL.format(repo=repo, path=dest) + + async with semaphore: + response = await delete( + session=session, url=url, data=data, headers=headers + ) + + return response + + +async def check_exists(*, session, repo, dest, token, semaphore, skip_missing): + headers = {"Authorization": "Bearer {token}".format(token=token)} + url = BASE_URL.format(repo=repo, path=dest) + + async with semaphore: + response = await get( + session=session, + url=url, + headers=headers, + skip_missing=skip_missing, + ) + + return response pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy