# 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()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ankit-apdc.gitbook.io/system-design/python-framework/flask.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
