onlywade / airtng-flask

AirTNG - Rental-by-owner properties fit for a Captain, implemented in Python with Flask

Home Page:https://www.twilio.com/docs/tutorials/walkthrough/workflow-automation/python/flask

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Airtng App: Part 1 - Workflow Automation with Python | Flask

Build Status

Learn how to automate your workflow using Twilio's REST API and Twilio SMS. This example app is a vacation rental site, where the host can confirm a reservation via SMS.

Read the full tutorial here!

Local Development

  1. You will need to configure Twilio to send requests to your application when SMS are received.

    You will need to provision at least one Twilio number with sms capabilities so the application's users can make property reservations. You can buy a number right here. Once you have a number you need to configure it to work with your application. Open the number management page and open a number's configuration by clicking on it.

    Remember that the number where you change the SMS webhook must be the same one you set on the TwilioPhoneNumber setting.

    To start using ngrok in our project you'll have execute to the following line in the command prompt.

    ngrok http 5000 -host-header="localhost:5000"
    

    Keep in mind that our endpoint is:

    http://<your-ngrok-subdomain>.ngrok.io/confirm
    
  2. Clone this repository and cd into it.

    git clone git@github.com:TwilioDevEd/airtng-flask.git
    
  3. Create a new virtual environment.

  4. Install the requirements.

    pip install -r requirements.txt
    
  5. Edit the following keys/values for the config.py file inside the airtng_flask/ directory. Be sure to replace the place holders and connection string with real information. Replace the connection string preferably under development config.

    TWILIO_ACCOUNT_SID = 'your_twilio_account_sid'
    TWILIO_AUTH_TOKEN = 'your_twilio_auth_token'
    TWILIO_NUMBER = 'your_twilio_phone_number'
    
    SQLALCHEMY_DATABASE_URI = 'sqlite://'
    
  6. Run the migrations.

    python manage.py db upgrade
    
  7. Start the development server.

    python manage.py runserver
    
  8. Check it out at http://localhost:5000

That's it!

Run the tests

You can run the tests locally through coverage:

  1. Run the tests.

    $ coverage run manage.py test
    

You can then view the results with coverage report or build an HTML report with coverage html.

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

About

AirTNG - Rental-by-owner properties fit for a Captain, implemented in Python with Flask

https://www.twilio.com/docs/tutorials/walkthrough/workflow-automation/python/flask

License:MIT License


Languages

Language:Python 65.7%Language:HTML 20.8%Language:CSS 12.4%Language:Mako 1.2%