Last active
February 6, 2017 04:13
-
-
Save ronaknnathani/95d13f353f6f5f1b8a38a8c2ad916fa5 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
#!/usr/bin/env python | |
import requests | |
import logging | |
import time | |
import os | |
import json | |
from requests.auth import HTTPBasicAuth | |
logging.basicConfig(level=logging.DEBUG) | |
start_time = time.time() | |
github_username = os.environ['github_username'] | |
github_access_token = os.environ['github_access_token'] | |
session = requests.Session() | |
for i in range(50): | |
url = "https://api.github.com/users/{}" | |
response = session.get(url.format(i+1), auth=HTTPBasicAuth(github_username, github_access_token)) | |
response_dict = json.loads(response.text) | |
print(response_dict['name']) | |
print("--- %s seconds ---" % (time.time() - start_time)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment