Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Count Limit #10

Open
fjmoon1 opened this issue Mar 7, 2018 · 9 comments
Open

User Count Limit #10

fjmoon1 opened this issue Mar 7, 2018 · 9 comments

Comments

@fjmoon1
Copy link

fjmoon1 commented Mar 7, 2018

Hello again,
Thanks for your feedback on my previous issues. I am able to pull "user actions" by using "_get()" however, I am unable to pull more than 200 users. I've tried setting the limit to 5000 but it will only return 200. My code below generates a dataframe called "schActivity" and it never has a length greater than 200 although there are over 4000 users in our schoology account. I have admin-level access to our schoology account. Any assistance would be greatly appreciated. Thanks!

Here is my code:

import schoolopy
import time
import datetime
import pandas as pd
import json

sc = schoolopy.Schoology(schoolopy.Auth('xxxxxxxxxxxxxxxxxxxx', 'yyyyyyyyyyyyyyyyyyy'))
sc.limit = 5000 # Only retrieve 10 objects max
sc.start = 1

d = datetime.date(2018,3,7)
unixtime = time.mktime(d.timetuple())
print(unixtime)

end = 1520406000
start = end - 86400

print('Start_time: ' + time.ctime(start))
print('End_time: ' + time.ctime(end))

schActivity = []

cnt = 0
cnt2 = 0

for i in sc.get_users():
#print(i)
schActivity.append(i['uid'])

studentActions = []

for k in schActivity:
k=int(k)
m = sc._get('analytics/users/%s?start_time=%s&end_time=%s&start=0' % (k, start, end))['actions']
if len(m) > 0:
studentActions.append(m)

@ErikBoesen
Copy link
Owner

ErikBoesen commented Mar 7, 2018

Are you able to make this request as expected elsewhere? It sounds like this could be an issue with Schoology's API.

@fjmoon1
Copy link
Author

fjmoon1 commented Mar 7, 2018

Thanks for the quick response! I'm able to pull all the records from the Schoology website's "School Analytics" page via "Export All Users." However, I'm not having much luck getting the "get_user"actions()" to work as I expressed in my previous issues. I am relatively new to working with APIs and I'm not sure how to proceed without using your python wrapper. Thank you for your patience.

@jedieaston
Copy link

Schoology isn't responding to my ticket about this -- can anyone get a hold of someone over there and ask them what's up?

@ErikBoesen
Copy link
Owner

@jedieaston This project is completely unofficial, we have no more access to Schoology than you do. Is this issue present when making direct requests to the API?

@jedieaston
Copy link

@ErikBoesen I'm about to check, just thought someone who's a schoology admin might be able to contact support for us and ask if they happened to see this issue. I'm going to try again and see, but I did once before and it wasn't different whether or not I was using the library.

@ErikBoesen
Copy link
Owner

@jedieaston Understood, sorry if I misinterpreted your question. Unfortunately there's not much I can do as I'm just a student and am not really able to debug these issues. It's not the greatest situation, I confess.

@jedieaston
Copy link

@ErikBoesen No worries, I'm a student too. Hopefully they get back to me soon, because otherwise this library works great for what I'm doing with it.

@jedieaston
Copy link

A little update, Schoology just got back to me.

If this problem is affecting you, at the end of a request you will get something like this:
], "total": "300", "links": { "prev": "https://api.schoology.com/v1/groups/000000000/enrollments?start=0&limit=200", "self": "https://api.schoology.com/v1/groups/000000000/enrollments?start=1&limit=200", "next": "https://api.schoology.com/v1/groups/00000000/enrollments?start=201&limit=200" } }

So, the library would have to implement a multi-get, where if the total exceeded 200, then it would make requests for every 200 and then return the whole result.

They left my ticket open if you need more information, @ErikBoesen

@BraydenKO
Copy link

I know this is a little late (four years!!) but for those who run into this issue as well:
I couldn't figure out how to implement a multiget, it kept returning an empty list, but you could simply just add a start=x parameter for Schoology._get, and call it for every 200.

However, if anyone got a multiget working, could you show me what you did?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants