Last active
August 1, 2016 13:00
-
-
Save abustamam/3da1bf71bdac52c06fc95efd4ce144cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script config | |
CERTS_URL = 'https://review-api.udacity.com/api/v1/me/certifications.json' | |
ASSIGN_URL = 'https://review-api.udacity.com/api/v1/projects/{pid}/submissions/assign.json' | |
REVIEW_URL = 'https://review.udacity.com/#!/submissions/{sid}' | |
ACCOUNT_SID = 'TWILIO SID' | |
AUTH_TOKEN = 'TWILIO AUTH TOKEN' | |
REQUESTS_PER_SECOND = 0.5 # Please leave this alone. | |
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN) | |
# Other code | |
def request_reviews(token): | |
# other code | |
for pid in itertools.cycle(project_ids): | |
resp = requests.post(ASSIGN_URL.format(pid = pid), headers=headers) | |
if resp.status_code == 201: | |
submission = resp.json() | |
logger.info("") | |
logger.info("=================================================") | |
logger.info("You have been assigned to grade a new submission!") | |
logger.info("View it here: " + REVIEW_URL.format(sid = submission['id'])) | |
client.messages.create( | |
to="YOUR VERIFIED TWILIO TXT NUMBER", | |
from_="YOUR PURCHASED TWILIO NUMBER", | |
body="Got assignment", | |
) | |
logger.info("=================================================") | |
logger.info("Continuing to poll...") | |
# other code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment