Closed jspeed-meyers closed 1 year ago
It seems that using:
python3 funderfinder/get_funders.py repo_name=https://github.com/georgetown-cset/funder-finder
gets me past that bug, but then I have a new one.
New bug:
Traceback (most recent call last):
File "/Users/johnspeedmeyers/Desktop/repos/public/funder-finder/funderfinder/get_funders.py", line 39, in <module>
print(get_project_funders(args.repo_name))
File "/Users/johnspeedmeyers/Desktop/repos/public/funder-finder/funderfinder/get_funders.py", line 20, in get_project_funders
funding = finder.run(repo_name)
File "/Users/johnspeedmeyers/Desktop/repos/public/funder-finder/funderfinder/sources/github_sponsors.py", line 178, in run
num_sponsors = self.parse_gh_user_gh_sponsors_json(sponsors_json)
File "/Users/johnspeedmeyers/Desktop/repos/public/funder-finder/funderfinder/sources/github_sponsors.py", line 144, in parse_gh_user_gh_sponsors_json
gh_user_gh_sponsors_json["data"]["user"]["sponsors"]["edges"]
KeyError: 'data'
Ah, it looks like it's related to the scope of the token. Trying a fix now.
Two initial thoughts:
repo_name
argument should be.The scopes must include public_repo
, read:org
and user:email
And now new error:
Traceback (most recent call last):
File "/Users/johnspeedmeyers/Desktop/repos/public/funder-finder/funderfinder/get_funders.py", line 39, in <module>
print(get_project_funders(args.repo_name))
File "/Users/johnspeedmeyers/Desktop/repos/public/funder-finder/funderfinder/get_funders.py", line 19, in get_project_funders
finder = finder_class()
File "/Users/johnspeedmeyers/Desktop/repos/public/funder-finder/funderfinder/sources/opencollective.py", line 20, in __init__
assert os.environ.get(
AssertionError: Please `export OPENCOLLECTIVE_API_KEY=<your opencollective api key>
So the documentation should also add information on adding an Open Collective API key. In fact, I don't know how to do that. I need to look into that.
The documentation here works: https://blog.opencollective.com/open-collective-graphql-api-preview/
Okay, so I'll add this to the README too!
PR #34 now includes Open Collective API information.
@jmelot:
The documentation should be specific on what the input to the repo_name argument should be. The documentation should be specific on the scopes needs for the GitHub token.
Do I have the scopes (public_repo
, read:org
and user:email
) for the GitHub token correct? And should the repo_name
flag actually use the full GitHub URL and not just the org and repo name?
Once I get your input on this, I can further revise PR #34 (or we can merge #34 as is and I can work on another PR).
So three things:
1.) The repo_name arg is a positional argument. If you pass in repo_name=foo/bar
, the entire string repo_name=foo/bar
is passed as the github url, which leads to an unmatched repo. I updated the readme to reflect this
2.) The github_sponsors finder doesn't handle repos that don't exist, it would seem, I'll submit a PR to fix this
3.) Yeah, a token with scopes admin:org, read:user, repo, user:email, workflow
does work! If you're willing to update the README to reflect this I'm all for it
Sweet. I'll work on a new PR on Friday.
When I run:
I get:
Am I doing something wrong? Is there really a bug?
pytest
passes when I run it. hmmm...