Last active
December 6, 2017 03:13
-
-
Save ronaknnathani/b20410f84caeda41a8b69a7c47a644ec 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 | |
# Using same TCP connection for all HTTP requests | |
import os | |
import json | |
import time | |
import logging | |
import requests | |
from requests.auth import HTTPBasicAuth | |
logging.basicConfig(level=logging.DEBUG) | |
start_time = time.time() | |
def get_venmo_data(limit): | |
session = requests.Session() | |
url = "https://venmo.com/api/v5/public?limit={}" | |
for i in range(50): | |
response = session.get(url.format(limit)) | |
response_dict = json.loads(response.text) | |
for transaction in response_dict["data"]: | |
print(unicode(transaction["message"])) | |
url = response_dict["paging"]["next"] + "&limit={}" | |
if __name__ == "__main__": | |
limit = 1 | |
get_venmo_data(limit) | |
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