> For the complete documentation index, see [llms.txt](https://ankit-apdc.gitbook.io/system-design/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ankit-apdc.gitbook.io/system-design/python-framework/flask.md).

# Flask

### Restful Sample App using Flask

### Flask app with Blueprint

### Flask in production

&#x20;<https://faun.pub/deploy-flask-app-with-nginx-using-gunicorn-7fda4f50066a>

<https://faun.pub/deploy-flask-app-with-nginx-using-gunicorn-7fda4f50066a>

* run the gunicorn with --preload
* async operation with gunicorn
* use eventlet
* add timeout

gunicorn --preload -w 16 --threads 2 -k eventlet -b 0.0.0.0:5007 app:app --timeout 120

### App Documentation

### Postman

### Swagger with Flask

{% embed url="<https://editor.swagger.io/>" %}

{% embed url="<https://swagger.io/blog/api-strategy/difference-between-swagger-and-openapi/>" %}

## Implementation

**Objective**: Create an app with 4 endpoints, which returns different information and insights of Github profiles. 3 endpoints include:

1. Input: location and programming language&#x20;

   Output: Return 30 Github profile URLs&#x20;
2. Input: Github profile URL

   Output: Profile personal information summary (with different attributes)
3. Input: Github profile URL

   Output: All repository summary connected to the profile

The object to create 3 endpoints is to understand, how to structure and separate multiple requests.

```
url = "https://api.github.com/search/users?q=location:{0}+language:{1}".format(first, second)
response_dict = requests.get(url).json()
```
