Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.
/ make-python Public archive

An example Python app that allows a user to engage with the Root Insurance API via a Slack bot

Notifications You must be signed in to change notification settings

offerzen/make-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

make-python

This is an example Python app that allows a user to engage with the Root Insurance API via a Slack bot.

The app makes use of the official Slack Developer Kit for Python package, specifically the Real Time Messaging WebSocket-based api.

Getting set up

The example app was developed using Python 3.6 but should work with all versions of Python 3. Changing the code for python 2.7 compatability shouldn't be too much work.

We recommend using an environment manager to set up an isolated python environment for this app. We use virtualenv but others will also do (conda, if you're using an anacondas python installation).

The examples below are for virtualenv on a but shouldn't be too different for other operating systems (unless you're using Windows - then you're on your own) and environment managers.

Clone the repo

$ git clone [email protected]:Offerzen/make-python.git
$ cd make-python

Set up and activate your environment

$ virtualenv -p /usr/local/bin/python3 make-python
$ source make-python/bin/activate

Install the requirements

$ pip install -r requirements.txt

Set up the environment variables

Settings are in the settings/settings.py file

SLACK_API_TOKEN: Your slackbot's API token

SANDBOX: SANDBOX Yes/No aka NO is live!!

ROOT_APP_ID: Your Root app ID

ROOT_APP_SECRET: Your Root app's api key/ secret key

The following environment variables are optional for the app:

SLACK_API_TOKEN: Your slackbot's API token

ROOT_APP_ID: Your Root app's id

ROOT_APP_SECRET: Your root app's secret key

Running the tests

The tests are still red at the moment (unless the settings file is updated).

$ pytest

Sandbox auth

Sandbox auth requires basic auth in the format username(apikey):password("") ex: "sandbox_apikey: "

TODO

  • Generic Root Request method
  • Break out api endpoints into classes
  • RootException on requests
  • Break out project into proper module structure
  • setup.py for lib install
  • Mock web requests in tests

Run the app

$ python run.py

About

An example Python app that allows a user to engage with the Root Insurance API via a Slack bot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages