Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple Foursquare Checkins Archive of one User
import requests, os, glob, json, sys, webbrowser
you = 'self'
data = 'checkins'
try: os.mkdir(data)
except Exception: pass
if len(sys.argv) < 2:"""""" % (cid, 'http://localhost:8000/'))
token = sys.argv[1]
def run(offset = 0):
already = glob.glob("%s/*.json" % data)
start = '' % (you, token, offset)
r = requests.get(start)
has_new = False
for t in r.json['response']['checkins']['items']:
if ("%s/%s.json" % (data, t['id'])) not in already:
json.dump(t, open('%s/%s.json' % (data, t['id']), 'w'))
has_new = True
if has_new:
run(offset + 100)
print 'starting 4sq archive of @%s' % you

This comment has been minimized.

Copy link

@twolfson twolfson commented Dec 19, 2018

Had to fork to add version parameter (now required) and a few safeguards like checking status code. Still works great though 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment