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

You must specify a valid end_time #8

Open
fjmoon1 opened this issue Feb 7, 2018 · 8 comments
Open

You must specify a valid end_time #8

fjmoon1 opened this issue Feb 7, 2018 · 8 comments

Comments

@fjmoon1
Copy link

fjmoon1 commented Feb 7, 2018

I am attempting to pull user analytics info with the _get method. When I do, I get: You must specify a valid end_time. I am able to Authenticate into Schoology with my key and secret, but I am not listing them in the following code snippet"

import schoolopy
import time
import datetime
import json

sc = schoolopy.Schoology(schoolopy.Auth('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'zzzzzzzzzzzzzzzzzzzzzzzzz'))
sc.limit = 10 # Only retrieve 10 objects max

d = datetime.date(2018,2,6)
unixtime = time.mktime(d.timetuple())

#print(time.time())
#print(unixtime)

print('get_me: ' + sc.get_me()['uid'])

z = ''

start_time = int(time.time() - 100000)
end_time = int(time.time())

print('Start_time: ' + str(start_time))
print('End_time: ' + str(end_time))

for x in sc.get_users():
print(x['uid'])
y = int(x['uid'])
print(sc._get('analytics/users/%s?start_time=%s&end_time=%s' % (y, start_time, end_time)))

@ErikBoesen
Copy link
Owner

Thank you so much for reporting this issue! I will fix this in just a moment.

@ErikBoesen
Copy link
Owner

Unfortunately, I get no such error when running the snippet you've posted.

@rmduddy
Copy link
Contributor

rmduddy commented Feb 8, 2018

Try:
print(sc._get('analytics/users/%s?start_time=%s&end_time=%s&start=0' % (y, start_time, end_time)))

@ErikBoesen
Copy link
Owner

I still don't get the error you've described.

@rmduddy
Copy link
Contributor

rmduddy commented Feb 8, 2018

Hey Eric, no longer OP. I was able to replicate his issue, and was suggesting a solution... Nothing to do with this wrapper, I just think that endpoint that he is manually specifying is expecting more input so doesn't think that his end time is valid. Interesting if the original snippet ran on your implementation though.

@ErikBoesen
Copy link
Owner

ErikBoesen commented Feb 8, 2018

@rmduddy I should mention that I actually didn't get any output either, though I got no error as described by the reporter. I had always assumed this was due to my account not having permissions to access student analytics (I myself am a student, and unlike perhaps yourselves I have limited access to my school's API).

@rmduddy
Copy link
Contributor

rmduddy commented Feb 8, 2018

@ErikBoesen Ah gotcha, yeah I was going to ask if you were running on a basic implementation or if you were on enterprise (although I don't know if basic has API access), that makes sense. Something to keep in mind if specific functions for analytics eventually are written into the wrapper. I have full access, but haven't had much time to play with this wrapper since last we spoke but am happy to help with things that need full admin powers when able.

@ErikBoesen
Copy link
Owner

@rmduddy There are a couple places where I couldn't test for which new wrapper functions would be terrific. All the analytics is a good example. Also the multi-get and multi-post. If you could help with that I'd much appreciate it!

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

3 participants