Skip to content

Commit

Permalink
Create github.py
Browse files Browse the repository at this point in the history
  • Loading branch information
adrupp committed Mar 23, 2023
1 parent aaa6114 commit 9b638b8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/python/github.py
@@ -0,0 +1,26 @@
import requests

# Set up authentication using personal access token
access_token = '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'
headers = {'Authorization': f'token {access_token}'}

# Define the API endpoint for creating pull requests
api_url = 'https://api.github.com/repos/opendatazurich/BinBuddy/pulls'

# Define the pull request parameters
params = {
'title': 'Your pull request title',
'head': 'adrian', # branch where your changes are located
'base': 'main', # branch where you want to merge your changes
'body': 'Your pull request description'
}

# Make a POST request to create the pull request
response = requests.post(api_url.format(owner='opendatazurich', repo='BinBuddy'), headers=headers, json=params)

print(response.status_code)
# Check the response status code
if response.status_code == 201:
print('Pull request created successfully!')
else:
print('Error creating pull request.')

0 comments on commit 9b638b8

Please sign in to comment.