Found this content helpful? Log in or sign up to leave a like!
User Pageviews Pagination <sigh/>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am an admin and Python novice. I am trying to create a script that will pull a user's pageviews within a date range and save that to a CSV file. To date, I have only be able to access the first page of results. I can't seem to get the script to navigate through subsequent pages.
I have seen posts with example script snippets (here, here, and here) but am having a difficult time implementing those strategies. I have attached two example files, one using the Requests module and one using the CanvasAPI module.
Can someone please look at my scripts and point out what I am missing?
Thank you in advance for any assistance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was working through this same problem today. I had previously made a Python script 2 years ago for this same purpose and the pagination worked fine then. Today I was experiencing the same issue you were.
I think it may be a permissions issue with your API token. When I ran the script to pull up my own page views, it worked as expected returning thousand of rows for the given time frame. When I try to run it for another user, I would only get the first 100 records.
If I remember correctly - I was a full Canvas Admin during our migration process, which was around the same time I originally created the script. Now I have slightly less admin privileges.
Writing through this post reminded me that there is an "as_user_id" parameter you can send with your request. Adding this parameter to my script let me get the additional records you would expect. This does require you have the "act as" permission.
I hope this helps and thank you for helping me figure out stuff on my end!
-Michael