Appreciate any help - using Django and Github API for the first time together. I have a simple url that I get from an api request from a repo's pull requests. I'm looping through them getting to the diff_url property that I want to examine.
In the chrome browser, it works fine and I'm displaying the text output of the code differences for the pull. Looking at the network traffic, the network call is giving a 302 to another url which includes a token.
In incognito chrome as well as curl, I'm getting an 404 error.
I am using github3.py to get the pull model, and requests (with simple authentication) to try and access the diff_url from the pull model property.
I'm wondering why the browser works and neither the code nor curl will work at all.
Here is the Python code:
def getAllPullRequestsForRepo(self, repo_name):
''' Return pull request and tag object for repository
Github: Every pull request is an issue, but not every issue is a pull request
For each pull request = issue - get associated labels
'''
# TODO look at repo array to get repository (save as object)
repoOwner = self.org_name + '/' + repo_name
github = Github(self.username, self.password)
repository = github.get_repo(repoOwner)
pullDict = []
pulls = repository.get_pulls('all')
pullDatum = {}
for pull in pulls:
assigneeName = ''
assigneeLogin = ''
if pull.assignee:
assigneeName = pull.assignee.name
assigneeLogin = pull.assignee.login
pullDatum = {
'id': pull.id,
'assignee': assigneeName,
'assignee_login': assigneeLogin,
'title': pull.title,
'body': pull.body,
'state': pull.state,
'created': pull.created_at,
'diff_url': pull.diff_url,
'diff_content': '',
'issues_url': pull.issue_url,
'issues_content': '',
'commits_url': pull.commits_url,
'commits_content': '',
}
# Get the code differences and load into diff data
diff_url_data = requests.get(pull.diff_url, auth=(self.username, self.password))