Skip to content

Instantly share code, notes, and snippets.

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