Skip to main content

Latest Version MIT GitHub stars

DOWNLOADS DOWNLOADS_M DOWNLOADS_W

Flask-Yookassa - Integration of Flask and YuKassa.

Installation

Install the latest stable version by running the command:

pip install Flask-Yookassa

Configuration

The following configuration options are available to specify:

Option

Description

YOOKASSA_SHOP_ID

Required. Store ID issued by ЮKassa.

YOOKASSA_SHOP_SECRET_KEY

Required. The secret key of the store, issued by ЮKassa.

YOOKASSA_NOTIFICATIONS_IP

A set of IP addresses or masks from which hook calls are allowed. By default: set().

Custom error handler

You can register your ЮKassa API error handler. For example, display a standard Flask page for HTTP errors:

from flask import Flask, abort
from flask_yookassa import Yookassa


app = Flask(__name__)
app.config.from_prefixed_env()
yookassa = Yookassa(app)


@yookassa.errorhandler
def handle_api_error(resp, code):
    """Registers a custom error handler for the ЮKassa API."""
    abort(code, resp['description'])

Only HTTPException will be caught and handled automatically, other exception types need to be handled manually.

Notifications handler

Any entry point can be decorated with a special flask_yookassa.Yookassa.hookhandler decorator.

The decorator checks the request for spam. The request must come from allowed IP addresses, the resource is checked for existence and for the relevance of the status:

from flask import Flask
from flask_yookassa import Yookassa


app = Flask(__name__)
app.config.from_prefixed_env()
yookassa = Yookassa(app)


@app.route('/callback')
@yookassa.hookhandler
def handle_hook(notification):
    """The entry point handles the ЮKassa notifications."""
    # Any code to handle the event.
    return ''

Metadata

Release files for Flask-Yookassa 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Yookassa 0.1.0
File Size Uploaded Provenance
Flask-Yookassa-0.1.0.tar.gz 5.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Yookassa 0.1.0
File Interpreter ABI Platform
Flask_Yookassa-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / Flask-Yookassa-0.1.0.tar.gz

Download URL Flask-Yookassa-0.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0447a8fd965978c2ecfa16143af90e17c3848d8b974a2ba1c858fff7a526a395
BLAKE2b-256 checksum
How to use checksums
1c3c63311734a8dbb47c3f3188505eed87cd3f29edddb74ce12e5f5cd383eb3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / Flask_Yookassa-0.1.0-py3-none-any.whl

Download URL Flask_Yookassa-0.1.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e392da833df0d44249e47f20098717551ad1c66a02804f4dd491542db740c452
BLAKE2b-256 checksum
How to use checksums
b9d1298b6099690a1434a64cea60a17f2a4cb5639b2c8c7d518bdd0cf5d9c0f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Security for Flask-Yookassa 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page