Skip to content

How to get the latest commit date of the file along with content details from GitHub API call #24481

Discussion options

You must be logged in to vote

finally got the expected result by using Graphql.here is the complete code

def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
    try:
        request = requests.post('https://api.github.***.com/graphql', json={'query': query}, headers=headers)
        return request.json()
    except e:
        returnVal = '404'
        query = """
                    {
                      repository(owner: \""""+ownerVal+"""\", name: \""""+repoVal+"""\") {
                        object(expression: \""""+branchVal+"""\") {
                          ... on Commit {
                            blame(path: \""""+folderVal+"/"+data['name']+"""\") {…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant