Skip to content

Instantly share code, notes, and snippets.

@ronaknnathani
Last active February 6, 2017 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronaknnathani/95d13f353f6f5f1b8a38a8c2ad916fa5 to your computer and use it in GitHub Desktop.
Save ronaknnathani/95d13f353f6f5f1b8a38a8c2ad916fa5 to your computer and use it in GitHub Desktop.
#!/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