Comments (6)
@laghee Please could you run the following command from an OSX terminal window? This is the underlying command used to retrieve Keychain passwords. Thanks.
security find-generic-password -s 'ghbackup' -a 'laghee' -w
from python-github-backup.
@martintoreilly OK, yep, that command successfully retrieves the token.
from python-github-backup.
Thanks. I'm not sure what's going on yet. I've done some digging around and I think the -s
option ("service") actually maps to the Where
field rather than the Name
field in an OSX Keychain password (see help output below for option list). I found a Keychain item where using the Name
field for the -s
option failed but using the Where
field succeeded.
> security find-generic-password --help
find-generic-password: illegal option -- -
Usage: find-generic-password [-a account] [-s service] [options...] [-g] [keychain...]
-a Match "account" string
-c Match "creator" (four-character code)
-C Match "type" (four-character code)
-D Match "kind" string
-G Match "value" string (generic attribute)
-j Match "comment" string
-l Match "label" string
-s Match "service" string
-g Display the password for the item found
-w Display only the password on stdout
If no keychains are specified to search, the default search list is used.
Find a generic password item.
from python-github-backup.
Oh, interesting. Yes, if I change the value of the where field to tacos
, the command no longer works with ghbackup
, but it does work with the new value. (I see the svce
attribute is changed to tacos
if I run the command without the -w
flag.)
from python-github-backup.
It looks like the error is not the command, that's correct as has been confirmed by running it from the command line.
Turns out it's an exception being thrown on the next line: auth = token + ':' + 'x-oauth-basic'
Here's the exception (I just added a call to raise
in the exception handler):
Traceback (most recent call last):
File "/Users/bbaron/workspacep/python-github-backup/bin/github-backup", line 1127, in <module>
main()
File "/Users/bbaron/workspacep/python-github-backup/bin/github-backup", line 1119, in main
authenticated_user = get_authenticated_user(args)
File "/Users/bbaron/workspacep/python-github-backup/bin/github-backup", line 591, in get_authenticated_user
data = retrieve_data(args, template, single_request=True)
File "/Users/bbaron/workspacep/python-github-backup/bin/github-backup", line 456, in retrieve_data
return list(retrieve_data_gen(args, template, query_args, single_request))
File "/Users/bbaron/workspacep/python-github-backup/bin/github-backup", line 412, in retrieve_data_gen
auth = get_auth(args)
File "/Users/bbaron/workspacep/python-github-backup/bin/github-backup", line 341, in get_auth
auth = token + ':' + 'x-oauth-basic'
TypeError: can't concat str to bytes
When I log the token
variable, it is in fact bytes not a string, however this is a Python 3 issue only. When run using Python 2, it works as expected.
Adding the following before concatenating the token fixes the issue:
if not PY2:
token = token.decode('utf-8')
Submitting a PR now :)
from python-github-backup.
@josegonzalez Looks like my "closes" line in the PR comment didn't automatically close this issue, but it can be closed now that this is merged.
from python-github-backup.
Related Issues (20)
- Procedures for Restore HOT 1
- Feature request: read personal access token (PAT) from stdin HOT 1
- The release script is broken HOT 1
- Personal Access Token (PAT) - Which scopes are need to backup an organiziation? HOT 1
- Add a --quiet option HOT 1
- Download watchers, forks, and stargazers of a repo
- A way to include the actual commits of backupped PRs?
- Add option to disable --prune when updating repository
- how to correctly update local backup? HOT 7
- Backup images and attachments in the issues
- Github-backup in 140 repository org backups nothing HOT 3
- Exclude specific repositories from backup HOT 1
- Add support for fine-grained tokens HOT 2
- Proposal to use API repository `pushed_at` instead of `update_at` field for `last_updated`
- something awry in --releases HOT 1
- When the `--lfs` option is used, after first clone non-lfs content is no longer fetched HOT 1
- Feature: offer docs how to run in docker HOT 4
- ERROR: 'gaierror' object is not iterable
- Automate releases HOT 5
- `--all-starred` does not backup anything HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-github-backup.