Last active
July 15, 2019 19:48
-
-
Save viveksyngh/ed67f26d3454b0403f333fbf3552a208 to your computer and use it in GitHub Desktop.
Astronaut Counter Handler
This file contains hidden or 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
| import requests | |
| import random | |
| import logging | |
| import time | |
| logging.basicConfig(level=logging.DEBUG) | |
| def handle(req): | |
| logging.debug("Making request to open notify API") | |
| start = time.time() | |
| r = requests.get("http://api.open-notify.org/astros.json") | |
| logging.debug( | |
| "Request completed. Total time taken %s", time.time() - start | |
| ) | |
| result = r.json() | |
| return result["number"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment