flask-ngrok-st 1.0.3
A simple way to demo Flask apps from your machine.
Keywords: flask ngrok demo

# flask-ngrok-st
[![Run it button](https://img.shields.io/badge/-run%20it%20now-brightgreen.svg?longCache=true&style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAF96VFh0UmF3IHByb2ZpbGUgdHlwZSBBUFAxAAAImeNKT81LLcpMVigoyk/LzEnlUgADYxMuE0sTS6NEAwMDCwMIMDQwMDYEkkZAtjlUKNEABZiYm6UBoblZspkpiM8FAE+6FWgbLdiMAAAF4ElEQVRYhe2WS2xdVxWGv7X2Pvf6Ppw4dqMAKkFJDWmcpqSxS1RhYVxBZ0Wo0gVUQBmCIhBCnRAmhQl0QFGYIMEQlIAcFcQkiFfd9CHR2qalqZ2octzmVcd52YmN7+OcvReDe6/jxEkoHQASXZOjc/ZZ+1/Pfy14X/7fRe50aIZCpfnPYaByOIpg71qnqWgIJtxZb/UFYjbkb39ecWYVt+b76JC3J9Hb6w15s7UO3/DBRoe8DB/N2u+1yQd6nerd4sRb1AXfqJ6U+4/Ntw0VwZoeY+3I1MZ33JMv+82IL4QYUpdlc+x841g7AjdjyM3gNt5fjJ3xm5j7MsK92uESFKgbMbXLqD0fgxxI+saet/H+RAYmUgCbuv+rht9nKv1a9AkigEE1YMHetBgO6oVzP5bhi0s2ipdhshUDVsBP9A9H0V9ol7+bWsTqEcNCK3uqXoW8QiLEhfR7btv4922yb3PQjkNuQ+6TpGDVgJmFVYFVzTuhqNjlxqyofUW2/e3ZthHSBg/jvY/rxp6DGMRaaCA4TEzEzBABM1pPdZqkqQwk/7j6TiwXp3RdviteSxsIrvVnXG0AmBDJtJjkCCmcfusx+fSV39oovhWBDYO46gsUNxPWdwWJUQHTslecQDDwAtcyWOexq9lT+rGx/eHE7hkt57bExayBSg7INBFP0TXDLwL1SKyGYKgTi5leOO2pLUCxdJ8Mzk82qz2r/xw1uPRmJtbrtL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cazTHA3OIPlPtcFlmOzfW0gyu4zEF2KUA8n28aM3LCR/KX0Js31YeJC8dKw0cM0M9Di4X1Lu+ok8dLa6ZiG52Yj2+5qVrFA9KR+580pmL27YTCPdQqwWcD4llGblM1emrmNcB7+lvPellDsvpaPccim9o5ihbUAbqbh3c4E9idoIzgzXev7X6f59+d+WfwIud1aCxWHYtAAAAABJRU5ErkJggg==)](https://colab.research.google.com/github/jakbin/flask-ngrok-st/blob/master/examples/flask_ngrok_example.ipynb)

[![PyPI version](https://badge.fury.io/py/flask-ngrok-st.svg)](https://badge.fury.io/py/flask-ngrok-st)

### This inspired from flask-ngrok

## Important :-
Some time, flask-ngrok need root or sudo permission. so , if you are a non-root user, you can't use it.

And flask-ngrok download ngrok in temp directory (/tmp in linux) so if you run it after shutdown or restart, its download ngrok every time.

**In flask-ngrok-st both problems are fixed.**

### Disclaimer:-
Use it only for educational purpose.


A simple way to demo Flask apps from your machine.
Makes your [Flask](http://flask.pocoo.org/) apps running on localhost available
 over the internet via the excellent [ngrok](https://ngrok.com/) tool.

## Compatability
Python 3.6+ is required.

## Installation

```bash
pip install flask-ngrok-st
```
### Inside Jupyter / Colab Notebooks
Notebooks have [an issue](https://stackoverflow.com/questions/51180917/python-flask-unsupportedoperation-not-writable) with newer versions of Flask, so force an older version if working in these environments.
```bash
!pip install flask
```
See the [example notebook](https://colab.research.google.com/github/gstaff/flask-ngrok-st/blob/master/examples/flask_ngrok_example.ipynb) for a working example.

## Quickstart
1. Import with ```from flask_ngrok_st import run_with_ngrok```
2. Add `run_with_ngrok(app)` to make your Flask app available upon running
```python
# flask_ngrok_example.py
from flask import Flask
from flask_ngrok_st import run_with_ngrok

app = Flask(__name__)
run_with_ngrok(app)  # Start ngrok when app is run

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == '__main__':
    app.run()
```
Running the example:
```bash
python flask_ngrok_example.py
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Running on http://<random-address>.ngrok.io
 * Traffic stats available on http://127.0.0.1:4040 
```