Skip to main content

An adaption of tinify as a flask extension

Project description

flask_tinify Build

An adaption of tinify as a flask extension

Installation

Install the API client:

pip install flask-tinify

Usage

from flask import Flask
from flask_tinify import Tinify

app = Flask(__name__)
tinify = Tinify(app)

Basic example

from flask import Flask, request
from flask_tinify import Tinify

app = Flask(__name__)
tinify = Tinify(app)

@app.route('/tinify', methods=['POST'])
def hello_png():
    image = request.form['image']
    if not image:
        return '', 400
    with image.strem as stream:
        tinify.from_buffer(stream.read()).to_buffer()

Project details


Download files

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

Source Distribution

flask_tinify-1.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

flask_tinify-1.2-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page