Call github api in python to get pull request information

background

I want to create a function that automatically notifies me when there is a schema change in the repository of the service that is the data source of the data infrastructure. I made it by pulling Pull Request information with github api, so a memo at that time. Authentication uses a personal access token ↓

Create a personal access token for the command line

Implementation


import requests

#Get only closed PR
URL = 'https://api.github.com/repos/owner/repo_name/pulls?&state=closed'
headers = {'Authorization': 'token xxxxx'} #Obtained access token
r = requests.get(URL.format(repo), headers=headers)
return r.json()

reference

-Github API Official

Recommended Posts

Call github api in python to get pull request information
Hit the New Relic API in Python to get the server status
[Python] I tried to get various information using YouTube Data API!
Get Google Fit API data in Python
How to get a stacktrace in python
Get Youtube data in Python using Youtube Data API
[Python] Get Python package information with PyPI API
When merging via pull request, there is no committer information in the response from Github API
Sample code to get the Twitter API oauth_token and oauth_token_secret in Python 2.7
I tried to get the movie information of TMDb API with Python
Use the MediaWiki API to get Wiki information
Get image URL using Flickr API in Python
Get pointers to struct members in Python ctypes
Get information about videos uploaded to YouTube [Python]
Python script to get note information with REAPER
Use os.getenv to get environment variables in Python
Http request in python
Evernote API in Python
Get date in Python
C API in Python 3
[Rails] How to get location information using Geolocation API
How to get the variable name itself in python
[First API] Try to get Qiita articles with Python
How to get the number of digits in Python
Get LEAD data using Marketo's REST API in Python
Convert callback-style asynchronous API to async / await in Python
Get YouTube Comments in Python
I tried to create API list.csv in Python from swagger.yaml
Get last month in python
Get your heart rate from the fitbit API in Python!
How to use the __call__ method in a Python class
Login to website in Python
Get information with zabbix api
Developed a library to get Kindle collection list in Python
I tried "How to get a method decorated in Python"
Get Terminal size in Python
Explicitly get EOF in python
How to get the last (last) value in a list in Python
How to get a list of built-in exceptions in python
Get GitHub information using PyGithub
Speech to speech in python [text to speech]
Get Python scripts to run quickly in Cloud Run using responder
Blender Python API in Houdini (Python 3)
Call the API with python3.
Dynamically call methods in Python
How to develop in Python
Get Evernote notes in Python
I tried to get various information from the codeforces API
Output product information to csv using Rakuten product search API [Python]
Get Alembic information with Python
Post to Slack in Python
Get Japanese synonyms in Python
An easy way to hit the Amazon Product API in Python
Try to get a list of breaking news threads in Python.
What to do if you get a minus zero in Python
I created a Python library to call the LINE WORKS API
How to get followers and followers from python using the Mastodon API
How to get a string from a command line argument in python
Make a request from Device Farm (appium python) to API Gateway
Regularly upload files to Google Drive using the Google Drive API in Python
How to send a request to the DMM (FANZA) API with python