Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

The HTTP Gateway of the Storyscript platform

Project description

Storyscript HTTP Gateway

API gateway server for executing Stories via HTTP.

http server as server
  when server listen method:'get' path:'/' as r
    log info msg:r.body
    log info msg:r.headers
    log info msg:r.headers['Host']
    r write data:'Hello World'
    r status code:200
    r finish
$ curl https://foobar.storyscriptapp.com/
Hello World

Development

Setup virtual environment and install dependencies

virtualenv -p python3.6 venv
source venv/bin/activate
pip install -r requirements.txt

You may need to tell pycurl the path to your openssl installation

pip install --install-option="--with-openssl" --install-option="--openssl-dir=/usr/local/opt/openssl" pycurl

See https://github.com/nahamsec/JSParser/issues/22

Run locally by calling

python -m app.main --logging=debug --debug

Register an endpoint

curl --data '{"endpoint": "http://localhost:9000/story/foo", "data":{"path":"/ping", "method": "post", "host": "a"}}' \
     -H "Content-Type: application/json" \
     localhost:8889/register

Now access that endpoint

curl -X POST -d 'foobar' -H "Host: a.storyscriptapp.com" http://localhost:8888/ping

Unregister an endpoint

curl --data '{"endpoint": "http://localhost:9000/story/foo", "data":{"path":"/ping", "method": "post", "host": "a"}}' \
     -H "Content-Type: application/json" \
     localhost:8889/unregister

Project details


Release history Release notifications

This version

0.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for story-http, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size story_http-0.2.0-py3-none-any.whl (16.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size story-http-0.2.0.tar.gz (10.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page