Jplaudir8
Jplaudir8

Reputation: 143

Paging with Microsoft Graph API on Python

I have been using some microsoft code sample, to start building an app that retrieves the groups and their members(groups/$expand=members). Now my problem is that because there is a lot of data I of course could not get everything through just one HTTP Request, so to test if I can access to the token value of the @odata.nextLink element that is in the json file I get as response, I've been trying to print it from my python program, and it retrieves me an error because of the '@'character (when I am trying to do print([email protected]) ). Maybe I am not using it correctly, so I would like to know guys for example making some arrows a html file that allows me to go back and forth, using the nextLink token.

This was my attempt to print the nextLink token (As I said I'm just trying to print the token value to see if I can use it for creating a page visualization in html, with arrows and so on):

@APP.route('/query')
def query():
    # query = "groups?$filter=startswith(displayName,'CASS')"
    query = "groups/?$expand=members"
    result = MSGRAPH.get(query, headers=request_headers()).data

    print([email protected])
    return flask.render_template('query.html',result=result, query=query)

enter image description here

This is what i want to grab:

enter image description here

Thanks!

Upvotes: 0

Views: 2080

Answers (1)

Bill the Lizard
Bill the Lizard

Reputation: 405765

Based on your last screen shot, @odata.nextLink is a key in a dictionary. Try this:

print(result['@odata.nextLink'])

Upvotes: 1

Related Questions