Skip to content

Instantly share code, notes, and snippets.

@heffo42
Last active July 7, 2019 19:05
Show Gist options
  • Save heffo42/fe27b440119e1f4b4c35294ebe91e45a to your computer and use it in GitHub Desktop.
Save heffo42/fe27b440119e1f4b4c35294ebe91e45a to your computer and use it in GitHub Desktop.
client = MongoClient('mongodb://<mongo ip>:27017', username='<username>', password='<password>', authSource='admin')
todoCol = client['twitter']['queriesTodo']
queryDates = []
since = date(2014,1,1)
qWords = "btc%2C%20OR%20bitcoin%2C%20OR%20crypto"
daterange = pd.date_range(date(2014,1,2), date(2019,7,5))
for until in daterange:
query = {"since" : since.strftime("%Y-%m-%d"), "until": until.strftime("%Y-%m-%d"), "qWords": qWords}
queryDates.append(query)
since = until
todoCol.insert_many(queryDates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment