From a09dd8153ca774f267aedf9f066e0a4a4033f749 Mon Sep 17 00:00:00 2001 From: Cameron Rodriguez <rod.cam2014+dev@gmail.com> Date: Mon, 24 Dec 2018 08:28:46 -0500 Subject: [PATCH] reduced app cycle to 15 seconds --- README.md | 4 ++-- xkcd_alt.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 59a5a15..255c2b1 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Make all other modifications to the accounts you would like to interact with, an You will need the [Requests](http://www.python-requests.org/en/latest/), [Requests-OAuthlib](https://requests-oauthlib.readthedocs.io/en/latest/), and [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/) libraries. If you have [Pipenv](https://pipenv.readthedocs.io/en/latest/), you can install them by running the command ```pipenv install``` inside the folder; otherwise, run ```pip install -r requirements.txt```. -Add your API keys and access tokens to your environmental variables by following [these instructions](https://java.com/en/download/help/path.xml). Then, just run ```python xkcd_alt.py``` in your command line and let it run! The bot respects the Twitter API limits, and will run every 60 seconds as long as the command line is open. +Add your API keys and access tokens to your environmental variables by following [these instructions](https://java.com/en/download/help/path.xml). Then, just run ```python xkcd_alt.py``` in your command line and let it run! The bot respects the Twitter API limits, and will run every 15 seconds as long as the command line is open. ### --> Running on Heroku @@ -45,7 +45,7 @@ $ git push heroku master $ heroku ps:scale worker=1 ``` -You should also install the [Logentries addon](https://elements.heroku.com/addons/logentries) to notify yourself of errors or crashes. The standard pattern for error messages is ```Entering log protection mode.``` +The program will now run once every 15 seconds. You should also install the [Logentries addon](https://elements.heroku.com/addons/logentries) to notify yourself of errors or crashes. The standard pattern for error messages is ```Entering log protection mode.``` ## Forks and Contributing diff --git a/xkcd_alt.py b/xkcd_alt.py index 7fcd4fb..e4dcf33 100644 --- a/xkcd_alt.py +++ b/xkcd_alt.py @@ -211,8 +211,8 @@ while True: # Initialize main account loop if original_tweet == 'crash': crash() elif original_tweet is None: - print('No new comics found. Sleeping for 60 seconds...') - time.sleep(60) + print('No new comics found. Sleeping for 15 seconds...') + time.sleep(15) continue else: # Retrieve text [body, num_tweets] = retrieve_text(original_tweet['entities']['urls'][0]['expanded_url']) @@ -228,6 +228,6 @@ while True: # Initialize main account loop else: # Successful Tweet del result - print('Sleeping for 60 seconds...') - time.sleep(60) + print('Sleeping for 15 seconds...') + time.sleep(15) continue \ No newline at end of file -- GitLab