Created
February 8, 2019 18:12
-
-
Save bahorn/bfefdf157ba72c45f8d1446c0ce8f412 to your computer and use it in GitHub Desktop.
Ideabot importer
This file contains hidden or 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
import requests | |
import time | |
url = 'https://us-central1-hackathonideas-6e61d.cloudfunctions.net/addIdea' | |
def addIdea(author, idea): | |
r = requests.post(url, data={'author': author, 'idea': idea}) | |
return r.status_code | |
with open('ideas.txt') as ideas: | |
for line in ideas.read().split('\n'): | |
try: | |
idea = line.split('. ')[1::][0] | |
author = '@covhacksoc' | |
sent = False | |
sleep = 1 | |
while not sent: | |
if addIdea(author, idea) != 200: | |
sleep = sleep * 2 | |
else: | |
sent = True | |
time.sleep(sleep) | |
except: | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment