Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

another bot #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

another bot #2

wants to merge 1 commit into from

Conversation

mfekadu
Copy link
Member

@mfekadu mfekadu commented Jan 17, 2020

No description provided.

@mfekadu
Copy link
Member Author

mfekadu commented Jan 17, 2020

@chidiewenike super cool!

Here’s an idea: lets modify the app.py to merge in your code by creating a new function

@app.route("/obtain-latest-message/", methods=['GET'])
def obtain-latest-message():
    # insert the setup code from another_bot.py
    # INSERT CODE FROM **within** WHILE LOOP, but not the while-loop itself
    # ...
    return message_posting, 200

Wrapping the code in this way, rather than the while-loop will integrate it into the API service that is running on Heroku

then (after we merge to master) you will see that the service is running forever at this endpoint:

https://calpoly-csai-groupme-bot.herokuapp.com/obtain-latest-message

@chidiewenike
Copy link
Collaborator

Sounds good!

@mfekadu
Copy link
Member Author

mfekadu commented Jan 17, 2020

You can test it locally by running

python3 app.py

Then point your browser to 0.0.0.0:8080/obtain-latest-message

don’t forget to pip3 install -r requirements

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants