Backing up releases using fine-grained token ends with an error
maximzasorin opened this issue · 3 comments
maximzasorin commented
Hi, thank you for a nice tool!
I use version 0.44.1 and try to backup my github repositories including releases and their assets.
When I use classic token, the backup completes successfully.
But when I use fine-grained token, the backup fails. The backup breaks on the first release that has assets:
% github-backup --token-fine=$GITHUB_TOKEN_FINE maximzasorin --all --private --gists
2024-01-04T17:09:51.852: Backing up user maximzasorin to /Users/maxim/Backups/github
...
2024-01-04T17:11:47.410: Requesting https://api.github.com/repos/maximzasorin/XXX/releases/XXX/assets?per_page=100&page=1
2024-01-04T17:11:48.016: can't concat str to bytes
I added some debug lines and got this:
Traceback (most recent call last):
File "/Users/maxim/Library/Python/3.9/bin/github-backup", line 57, in <module>
main()
File "/Users/maxim/Library/Python/3.9/bin/github-backup", line 51, in main
backup_repositories(args, output_directory, repositories)
File "/Users/maxim/Library/Python/3.9/lib/python/site-packages/github_backup/github_backup.py", line 1019, in backup_repositories
backup_releases(
File "/Users/maxim/Library/Python/3.9/lib/python/site-packages/github_backup/github_backup.py", line 1229, in backup_releases
download_file(
File "/Users/maxim/Library/Python/3.9/lib/python/site-packages/github_backup/github_backup.py", line 775, in download_file
request.add_header("Authorization", "Basic ".encode("ascii") + auth)
TypeError: can't concat str to bytes
josegonzalez commented
Pull requests welcome.
dale-primer-e commented
@maximzasorin can you test if you get the error again, I believe this issue should be fixed and can be closed.
maximzasorin commented
@dale-primer-e I checked the 0.45.1 version and backing up using fine grained token now works without errors, thank you.