Skip to content

Conversation

preved911
Copy link

I get different exceptions:

  1. if I try to give access_token instead login_or_token:
$ github-backup access_token dir_name --organization org_name --mirror
Traceback (most recent call last):
  File "/home/q/Downloads/sputnik_work/github.com/./env/bin/github-backup", line 11, in <module>
    load_entry_point('GitHub-Backup==0.1', 'console_scripts', 'github-backup')()
  File "/home/q/Downloads/sputnik_work/github.com/env/lib/python3.9/site-packages/github_backup/github_backup.py", line 108, in main
    account = gh.get_organization(args.login_or_token)
  File "/home/q/Downloads/sputnik_work/github.com/env/lib/python3.9/site-packages/github/MainClass.py", line 296, in get_organization
    headers, data = self.__requester.requestJsonAndCheck("GET", f"/orgs/{login}")
  File "/home/q/Downloads/sputnik_work/github.com/env/lib/python3.9/site-packages/github/Requester.py", line 353, in requestJsonAndCheck
    return self.__check(
  File "/home/q/Downloads/sputnik_work/github.com/env/lib/python3.9/site-packages/github/Requester.py", line 378, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/reference/orgs#get-an-organization"}
  1. if I try to give access_token as password:
$ github-backup org_name dir_name --organization org_name --password
Enter password for org_name:
Traceback (most recent call last):
  File "/home/q/Downloads/sputnik_work/github.com/./env/bin/github-backup", line 11, in <module>
    load_entry_point('GitHub-Backup==0.1', 'console_scripts', 'github-backup')()
  File "/home/q/Downloads/sputnik_work/github.com/env/lib/python3.9/site-packages/github_backup/github_backup.py", line 118, in main
    assert not (bool(config.get('password', None)) ^ IS_AUTHORIZED), account
AssertionError: Organization(login="org_name")

This PR should to fix this behaviour.

Signed-off-by: Ildar Valiullin <preved.911@gmail.com>
@preved911 preved911 force-pushed the fix/org_access_with_token branch 2 times, most recently from ab7b7af to b7ae023 Compare February 27, 2022 01:25
@preved911
Copy link
Author

--git flag params processing also fixed

Signed-off-by: Ildar Valiullin <preved.911@gmail.com>
@preved911 preved911 force-pushed the fix/org_access_with_token branch from b7ae023 to 88eb9fa Compare February 27, 2022 01:33
Signed-off-by: Ildar Valiullin <preved.911@gmail.com>
grugnog added a commit to grugnog/GitHub-Backup that referenced this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant