<commit_before># FlaskSR

FlaskSR provides an easy way to add streaming HTTP Responses for Flask.

## Why should you use this?

When the user sees something happening on the screen; the site has begun to render in response to their request. This critical first step tells the user that the site is responding to their action.
This measure is called "Time to First Paint". Today most of the websites are trying to minimize this measure. In order to enable this it is necessary to not send the complete response in one go but to push partial responses multiple times.

![flasksr-comparison](https://cloud.githubusercontent.com/assets/4745789/19354772/86697410-9185-11e6-83d0-a0c26f29e3d5.gif)

## Installation
Install the extension with the following command:

```
$ pip install flasksr
```

## Usage
Once installed, the FlaskSR is easy to use. Let's walk through setting up a basic application. Also please note that this is a very basic guide: we will be taking shortcuts here that you should never take in a real application.

To begin we'll set up a Flask app:

```py
from flask import Flask
from flasksr import BasicSR

app = Flask(__name__)


def render_menu():
    return """<ul style="list-style-type: none; margin: 0; padding: 0;">
        <li><a href="/">Home</a></li>
        <li><a href="#">News</a></li>
        <li><a href="#">Contact</a></li>
        <li><a href="#">About</a></li>
    </ul>"""


def render_body():
    return """
        <div style="margin-top: 50px;">Hello World!</div>
    """


@app.route('/')
def hello():
    return BasicSR(
        render_menu,
        render_body
    ).response


if __name__ == '__main__':
    app.run(host='0.0.0.0')
```

## Documentation

Complete documentation for FlaskSR is available on [FlaskSR's GitBook](https://arpitbbhayani.gitbooks.io/flasksr/).

## Contributing<commit_msg>README updated<commit_after># FlaskSR

FlaskSR provides an easy way to add streaming HTTP Responses for Flask.

## Why should you use this?

When the user sees something happening on the screen; the site has begun to render in response to their request. This critical first step tells the user that the site is responding to their action.
This measure is called "Time to First Paint". Today most of the websites are trying to minimize this measure. In order to enable this it is necessary to not send the complete response in one go but to push partial responses multiple times.

## Comparison and Impact
![github-example-with-flasksr](https://cloud.githubusercontent.com/assets/4745789/19834915/7354d69a-9e9a-11e6-8ab6-b7b95146a25c.gif)


## Installation
Install the extension with the following command:

```
$ pip install flasksr
```

## Usage
Once installed, the FlaskSR is easy to use. Following examples will help you through the complete usage

 - [How to use FlaskSR](https://github.com/arpitbbhayani/flasksr/blob/master/examples/basicsr.py)
 - [LayoutSR example](https://github.com/arpitbbhayani/flasksr/blob/master/examples/layoutsr.py)
 - [Advanced Usage: Github Profile Example](https://github.com/arpitbbhayani/flasksr/tree/master/examples/github-profile)

## Documentation

Complete documentation for FlaskSR is available on [FlaskSR's GitBook](https://arpitbbhayani.gitbooks.io/flasksr/).

## Contributing
{'fraction_non_alphanumeric': 0.10180926096289482, 'fraction_numerical': 0.025758969641214352, 'mean_word_length': 4.177777777777778, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3534330', 'n_tokens_mistral': 1033, 'n_tokens_neox': 952, 'n_words': 371}