Async Yoomoney API
Project description
API Yoomoney (async) - unofficial python library
This is an unofficial YooMoney API python library.
This repository was taken as a basis.
Introduction
This repository is based on the official documentation of YooMoney.
Features
Implemented methods:
- Access token - Getting an access token
- Account information - Getting information about the status of the user account.
- Operation history - This method allows viewing the full or partial history of operations in page mode. History records are displayed in reverse chronological order (from most recent to oldest).
- Operation details - Provides detailed information about a particular operation from the history.
- Quickpay forms - The YooMoney form is a set of fields with information about a transfer. You can embed payment form into your interface (for instance, a website or blog). When the sender pushes the button, the details from the form are sent to YooMoney and an order for a transfer to your wallet is initiated.
Installation
You can install with:
pip install aioyoomoney-api
You can install from source with:
git clone https://github.com/paranoik1/aioyoomoney-api
cd aioyoomoney-api
pip install .
Quick start
Access token
First of all we need to receive an access token.
- Log in to your YooMoney wallet with your username. If you do not have a wallet, create it.
- Go to the App registration page.
- Set the application parameters. Save CLIENT_ID and YOUR_REDIRECT_URI for net steps
- Click the Confirm button.
- Paste CLIENT_ID, REDIRECT_URI and CLIENT_SECRET insted of YOUR_CLIENT_ID, YOUR_REDIRECT_URI and YOUR_CLIENT_SECRET. Choose scopes and run code.
- Follow all steps from the program.
from aioyoomoney import authorize
token = authorize(
client_id=CLIENT_ID,
redirect_uri=REDIRECT_URI,
client_secret=CLIENT_SECRET,
scope=[
"account-info",
"operation-history",
"operation-details",
"incoming-transfers",
"payment-p2p",
]
)
print(token)
You are done with the most difficult part!
Account information
Paste YOUR_TOKEN and run this code:
import asyncio
from aioyoomoney import Client
async def client_info():
client = Client(YOUR_TOKEN)
account = await client.account_info()
print(f"Account: {account.id}")
print(f"Balance: {account.balance}")
print(f"Currency: {account.currency}")
print(f"Account Status: {account.account_status}")
print(f"Account Type: {account.account_type}")
print(f"Balance Details: {account.balance_details}")
print(f"Cards Linked: {account.cards_linked}")
asyncio.run(client_info())
Operation history
Paste YOUR_TOKEN and run this code:
import asyncio
from aioyoomoney import Client
from dataclasses import fields
async def get_operation_history():
client = Client(YOUR_TOKEN)
history = await client.operation_history()
print("Next record:", history.next_record)
for operation in history.operations:
for field in fields(operation):
if field.name != "kwargs":
print(field.name, '->', operation[field.name])
for key, value in operation.kwargs.items():
print(key, '->', value)
print("================================")
asyncio.run(get_operation_history())
Operation details
Paste YOUR_TOKEN with an OPERATION_ID (example: 670244335488002312):
import asyncio
from aioyoomoney import Client
from dataclasses import fields
async def get_operation_details():
client = Client(YOUR_TOKEN)
operation = await client.operation_details(OPERATION_ID)
for field in fields(operation):
if field.name != "kwargs":
print(field.name, '->', operation[field.name])
for key, value in operation.kwargs.items():
print(key, '->', value)
asyncio.run(get_operation_details())
Quickpay forms
Run this code:
import asyncio
from aioyoomoney import Quickpay
async def quickpay():
async with Quickpay(
receiver="899999999999999",
quickpay_form="shop",
targets="Sponsor this project",
payment_type="SB",
sum=10,
form_comment='test',
label="label"
) as quickpay:
print(quickpay.redirected_url)
print(quickpay.base_url)
print(quickpay.payload)
asyncio.run(quickpay())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aioyoomoney_api-0.0.10.tar.gz.
File metadata
- Download URL: aioyoomoney_api-0.0.10.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b77f25990575ee5c6527a4add4321acf8eb755dfa84c4c573533100fa9bbf3f
|
|
| MD5 |
4e05d1d934ce76ff8b06fac17f64be79
|
|
| BLAKE2b-256 |
ac92412108b85f46434609822965087f2f4b73f73418ce1dd47e4d75fdbd5dba
|
File details
Details for the file aioyoomoney_api-0.0.10-py3-none-any.whl.
File metadata
- Download URL: aioyoomoney_api-0.0.10-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
708af6b48db29d782859942217f6b2c0b0787286e75e200ee5cdee678ceb1e5b
|
|
| MD5 |
ffe648140eef9d2cede33feb9377155e
|
|
| BLAKE2b-256 |
bb517d84d415e8ede4559b8e35e8c8a6b59a608ff434ab2f86391298c1a64292
|