githubアプリを使用してoauthを実行してから、認証されたユーザーのリポジトリと組織を読み取ろうとしています。 ただし、「ユーザーのインストールのリスト」、「インストールのためにユーザーがアクセスできるリポジトリのリスト」、およびその他の多くのエンドポイントに関連するクエリの場合、同じpygithubAPIを取得できません。
参照リンク:http: //pygithub.readthedocs.io/en/latest/apis.html
PS。 以前はoauthアプリを使用していて、フローを実行できましたが、Webhookをサブスクライブする必要があるイベントもリッスンする必要があるため、githubアプリに切り替えました。
それに取り組みたいと思います。
この機能は非常に役立ちます:+1:
これは#1021でカバーされていますが、承認/マージを待っています。 @ sfdyeはそれを監視できますか?
auth_tokenを取得するには:
`
installations_url = " https://github.com/api/v3/app/installations "
インストール_応答=requests.get(installations_url、headers = headers、auth = CustomJWTAuth())
installations_response.raise_for_status()
for item in installations_response.json():
installation_id = item['id']
#print (installation_id)
access_tokens_url = "https://github.com/api/v3/app/installations/{installation_id}/access_tokens".format(
installation_id=installation_id)
access_tokens_response = requests.post(access_tokens_url, headers=headers, auth=CustomJWTAuth())
access_tokens_response.raise_for_status()
#print (access_tokens_response.json())
token = access_tokens_response.json()['token']
#print (token)
#return github3.login(token=token)
return token
raise Exception("No app installations")
`
https://pypi.org/project/github-bot-api/をチェックしてください。これを使用すると、GitHubアプリとそのインストール用のPyGithubクライアントが提供されます。 (免責事項:私はそのパッケージの作者です)
最も参考になるコメント
それに取り組みたいと思います。