Last active
July 7, 2019 19:05
-
-
Save heffo42/fe27b440119e1f4b4c35294ebe91e45a 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
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