Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (19 sloc) 0.577 kb
# -*- coding: utf-8 -*-
import os
import sys
import datetime
import time
import json
import twitter
t = twitter.Twitter(domain='api.twitter.com', api_version='1')
if not os.path.isdir('out/trends_data'):
os.makedirs('out/trends_data')
while True:
now = str(datetime.datetime.now())
trends = json.dumps(t.trends._(1)(), indent=1)
f = open(os.path.join(os.getcwd(), 'out', 'trends_data', now), 'w')
f.write(trends)
f.close()
print >> sys.stderr, "Wrote data file", f.name
print >> sys.stderr, "Zzz..."
time.sleep(60) # 60 seconds
Jump to Line
Something went wrong with that request. Please try again.