Unofficial YooMoney API python library

Overview

API Yoomoney - unofficial python library

This is an unofficial YooMoney API python library.

Summary

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 yoomoney --upgrade

You can install from source with:

git clone https://github.com/AlekseyKorshuk/yoomoney-api --recursive
cd yoomoney-api
python setup.py install

Quick start

Access token

First of all we need to receive an access token.

  1. Log in to your YooMoney wallet with your username. If you do not have a wallet, create it.
  2. Go to the App registration page.
  3. Set the application parameters. Save CLIENT_ID and YOUR_REDIRECT_URI for net steps
  4. Click the Confirm button.
  5. Paste CLIENT_ID and REDIRECT_URI insted of YOUR_CLIENT_ID and YOUR_REDIRECT_URI. Choose scopes and run code.
  6. Follow all steps from the program.
from yoomoney import Authorize

Authorize(
      client_id="YOUR_CLIENT_ID",
      redirect_uri="YOUR_REDIRECT_URI",
      scope=["account-info",
             "operation-history",
             "operation-details",
             "incoming-transfers",
             "payment-p2p",
             "payment-shop",
             ]
      )

You are done with the most difficult part!

Account information

Paste YOUR_TOKEN and run this code:

from yoomoney import Client

token = "YOUR_TOKEN"

client = Client(token)

user = client.account_info()

print("Account number:", user.account)
print("Account balance:", user.balance)
print("Account currency code in ISO 4217 format:", user.currency)
print("Account status:", user.account_status)
print("Account type:", user.account_type)

print("Extended balance information:")
for pair in vars(user.balance_details):
    print("\t-->", pair, ":", vars(user.balance_details).get(pair))

print("Information about linked bank cards:")
cards = user.cards_linked

if len(cards) != 0:
    for card in cards:
        print(card.pan_fragment, " - ", card.type)
else:
    print("No card is linked to the account")

Output:

Account number: 410019014512803
Account balance: 999999999999.99
Account currency code in ISO 4217 format: 643
Account status: identified
Account type: personal
Extended balance information:
   --> total : 999999999999.99
   --> available : 999999999999.99
   --> deposition_pending : None
   --> blocked : None
   --> debt : None
   --> hold : None
Information about linked bank cards:
No card is linked to the account

Operation history

Paste YOUR_TOKEN and run this code:

from yoomoney import Client

token = "YOUR_TOKEN"

client = Client(token)

history = client.operation_history()

print("List of operations:")
print("Next page starts with: ", history.next_record)

for operation in history.operations:
    print()
    print("Operation:",operation.operation_id)
    print("\tStatus     -->", operation.status)
    print("\tDatetime   -->", operation.datetime)
    print("\tTitle      -->", operation.title)
    print("\tPattern id -->", operation.pattern_id)
    print("\tDirection  -->", operation.direction)
    print("\tAmount     -->", operation.amount)
    print("\tLabel      -->", operation.label)
    print("\tType       -->", operation.type)

Output:

List of operations:
Next page starts with:  None

Operation: 670278348725002105
  Status     --> success
  Datetime   --> 2021-10-10 10:10:10
  Title      --> Пополнение с карты ****4487
  Pattern id --> None
  Direction  --> in
  Amount     --> 100500.0
  Label      --> 3784030974
  Type       --> deposition

Operation: 670244335488002313
  Status     --> success
  Datetime   --> 2021-10-10 10:10:10
  Title      --> Перевод от 410019014512803
  Pattern id --> p2p
  Direction  --> in
  Amount     --> 100500.0
  Label      --> 7920963969
  Type       --> incoming-transfer

Operation details

Paste YOUR_TOKEN with an OPERATION_ID (example: 670244335488002312) from previous example output and run this code:

from yoomoney import Client

token = "YOUR_TOKEN"

client = Client(token)

details = client.operation_details(operation_id="OPERATION_ID")

properties = [i for i in details.__dict__.keys() if i[:1] != '_']

max_size = len(max(properties, key=len))

for prop in properties:
    print(prop, " " * (max_size - len(prop)), "-->", str(details.__getattribute__(prop)).replace('\n', ' '))

Output:

operation_id     --> 670244335488002312
status           --> success
pattern_id       --> p2p
direction        --> in
amount           --> 100500.0
amount_due       --> None
fee              --> None
datetime         --> 2021-10-10 10:10:10
title            --> Перевод от 410019014512803
sender           --> 410019014512803
recipient        --> None
recipient_type   --> None
message          --> Justtext
comment          --> None
codepro          --> False
protection_code  --> None
expires          --> None
answer_datetime  --> None
label            --> 7920963969
details          --> Justtext
type             --> incoming-transfer
digital_goods    --> None

Quickpay forms

Run this code:

from yoomoney import Quickpay

quickpay = Quickpay(
            receiver="410019014512803",
            quickpay_form="shop",
            targets="Sponsor this project",
            paymentType="SB",
            sum=150,
            )

print(quickpay.base_url)
print(quickpay.redirected_url)

Output:

https://yoomoney.ru/quickpay/confirm.xml?receiver=410019014512803&quickpay-form=shop&targets=Sponsor%20this%20project&paymentType=SB&sum=150
https://yoomoney.ru/transfer/quickpay?requestId=343532353937313933395f66326561316639656131626539326632616434376662373665613831373636393537613336383639
You might also like...
TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API
TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API

TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API, which provides functiona

Unofficial instagram API, give you access to ALL instagram features (like, follow, upload photo and video and etc)! Write on python.

Instagram-API-python Unofficial Instagram API to give you access to ALL Instagram features (like, follow, upload photo and video, etc)! Written in Pyt

An unofficial Python wrapper for the 'Binance exchange REST API'

Welcome to binex_f v0.1.0 many interfaces are heavily used by myself in product environment, the websocket is reliable (re)connected. Latest version:

Unofficial Coinbase Python Library

Unofficial Coinbase Python Library Python Library for the Coinbase API for use with three legged oAuth2 and classic API key usage Version 0.3.0 Requir

✖️ Unofficial API of 1337x.to
✖️ Unofficial API of 1337x.to

✖️ Unofficial Python API Wrapper of 1337x This is the unofficial API of 1337x. It supports all proxies of 1337x and almost all functions of 1337x. You

This is a simple unofficial async Api-wrapper for tio.run

Async-Tio This is a simple unofficial async Api-wrapper for tio.run

Unofficial API wrapper for seedr.cc

Seedr API Unofficial API wrapper for seedr.cc Inspired by theabbie's seedr-api Powered by @harp_tech (Telegram) How to use You can install lib via git

Easy Google Translate: Unofficial Google Translate API

easygoogletranslate Unofficial Google Translate API. This library does not need an api key or something else to use, it's free and simple. You can eit

Clash of Clans developer unofficial api Wrapper to generate ip based token

Clash of Clans developer unofficial api Wrapper to generate ip based token

Comments
  • Response token is empty. Repeated request for an authorization token

    Response token is empty. Repeated request for an authorization token

    Hi, how can I fix this exception? yoomoney.exceptions.EmptyToken: Response token is empty. Repeated request for an authorization token

    I have already another project where I did everything similar and token came. Now I need to change account so I authorize new application.

    opened by progerg 8
  • maximum recursion depth exceeded

    maximum recursion depth exceeded

    привет, такая проблема, когда запускаю твой код как в примере все работает, когда пытаюсь запихнуть тот же код в aiogram начинаются ошибки переполнения, не подскажешь как поправить? еще вот такие ошибки: RecursionError: maximum recursion depth exceeded ERROR:asyncio:Task exception was never retrieved

    opened by chkyratov 3
  • TypeError: string indices must be integers

    TypeError: string indices must be integers

    При запросе token = "xxx" client = Client(token) history = client.operation_history(label="ххххх") Получаю ошибку Traceback (most recent call last): File "/x/x/x/x.py", line 70, in ym_get history = client.operation_history() File "/usr/local/lib/python3.8/site-packages/yoomoney/client.py", line 44, in operation_history return History(base_url=self.base_url, File "/usr/local/lib/python3.8/site-packages/yoomoney/history/history.py", line 96, in __init__ for operation_data in data["operations"]: TypeError: string indices must be integers

    opened by VReunov 3
  • ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

    ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

    It throws an error when I try to check payments status. It was stable for 3-4 days, now it throws such an error.

    urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
    Sep 07 11:50:45 localhost python3.7[29515]: During handling of the above exception, another exception occurred:
    Sep 07 11:50:45 localhost python3.7[29515]: Traceback (most recent call last):
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/aiogram/dispatcher/dispatcher.py", line 409, in _process_polling_updates
    Sep 07 11:50:45 localhost python3.7[29515]:     for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/aiogram/dispatcher/dispatcher.py", line 238, in process_updates
    Sep 07 11:50:45 localhost python3.7[29515]:     return await asyncio.gather(*tasks)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/aiogram/dispatcher/handler.py", line 116, in notify
    Sep 07 11:50:45 localhost python3.7[29515]:     response = await handler_obj.handler(*args, **partial_data)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/aiogram/dispatcher/dispatcher.py", line 286, in process_update
    Sep 07 11:50:45 localhost python3.7[29515]:     return await self.callback_query_handlers.notify(update.callback_query)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/aiogram/dispatcher/handler.py", line 116, in notify
    Sep 07 11:50:45 localhost python3.7[29515]:     response = await handler_obj.handler(*args, **partial_data)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/root/{}/handlers/general.py", line 199, in check_payment
    Sep 07 11:50:45 localhost python3.7[29515]:     if payment.is_paid():
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/root/{}/models.py", line 91, in is_paid
    Sep 07 11:50:45 localhost python3.7[29515]:     if api.is_paid(self.label):
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/root/{}/yandex_api.py", line 31, in is_paid
    Sep 07 11:50:45 localhost python3.7[29515]:     history = client.operation_history(label=label)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/yoomoney/client.py", line 53, in operation_history
    Sep 07 11:50:45 localhost python3.7[29515]:     details=details,
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/yoomoney/history/history.py", line 72, in __init__
    Sep 07 11:50:45 localhost python3.7[29515]:     data = self._request()
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/yoomoney/history/history.py", line 177, in _request
    Sep 07 11:50:45 localhost python3.7[29515]:     response = requests.request("POST", url, headers=headers, data=payload)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 61, in request
    Sep 07 11:50:45 localhost python3.7[29515]:     return session.request(method=method, url=url, **kwargs)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 542, in request
    Sep 07 11:50:45 localhost python3.7[29515]:     resp = self.send(prep, **send_kwargs)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 655, in send
    Sep 07 11:50:45 localhost python3.7[29515]:     r = adapter.send(request, **kwargs)
    Sep 07 11:50:45 localhost python3.7[29515]:   File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 498, in send
    Sep 07 11:50:45 localhost python3.7[29515]:     raise ConnectionError(err, request=request)
    Sep 07 11:50:45 localhost python3.7[29515]: requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
    
    
    opened by bekha-io 1
Releases(v0.1.0)
Owner
Aleksey Korshuk
Telegram: https://t.me/goodimpression
Aleksey Korshuk
A stable telegram bot to get restricted messages with custom thumbnail support

Save restricted content Bot A stable telegram bot to get restricted messages with custom thumbnail support

DEVANSH 3 Feb 09, 2022
Ciclo 1 - MisiónTIC - UIS (Retos)

misiontic_uis Ciclo 1 - MisiónTIC - UIS Reto 1: Fundamentos del Lenguaje Python Reto 2: Estructuras de Control Condicional Reto 3: Estructuras de Cont

9 May 24, 2022
Kodi script for proper Australian weather data

Kodi Oz Weather weather.ozweather Script for Kodi for high quality Australian weather data sourced directly from the BOM. Available from the Kodi offi

Jeremy Daalder 5 Nov 24, 2022
An simple python script for remove rockstar account for fivem, very useful for cheating or change account for unban from an server, remember change steam account.

This tool is used for be unbanned from servers, u need disconnect the discord, use other steam account and uninstall xbox for be unbanned 100%, it only work for unban in server, not global

MiguDEV 4 Oct 10, 2022
Mega.nz to GDrive uploader

Mega.nz to GDrive uploader With this telegram bot you can download files from mega.nz and upload those files or telegram uploaded files to GDrive. You

30 Nov 13, 2022
🤖 A fully featured, easy to use Python wrapper for the Walmart Open API

Wapy Wapy is a fully featured Python wrapper for the Walmart Open API. Features Easy to use, object oriented interface to the Walmart Open API. (Produ

Carlos Roso 43 Oct 14, 2022
Azure free vpn for students only! (Self hosted/No sketchy services/Fast and free)

Azpn-Azure-Free-VPN Azure free vpn for students only! (Self hosted/No sketchy services/Fast and free) This is an alternative secure way of accessing f

Harishankar Kumar 6 Mar 19, 2022
A muti pairs martingle trading bot for Binance exchange.

multi_pairs_martingle_bot English Documentation A muti pairs martingle trading bot for Binance exchange. Configuration { "platform": "binance_futur

51bitquant 62 Nov 16, 2022
Wats2PDF - Convert whatsapp exported chat(without media) into a readable pdf format

Wats2PDF convert whatsApp exported chat into a readable pdf format. convert with

5 Apr 26, 2022
A link shortner telegram bot version 2 with advanced features

URL-Shortner-Bot-V2 A link shortner telegram bot version 2 with advanced features Made with Python3 (C) @FayasNoushad Copyright permission under MIT L

Fayas Noushad 18 Dec 29, 2022
itadori webhook spammer fucker

itadori-webhook-spammer-fucker Installation # install the requirements $ python3 -m pip install -r requirements.txt $ python3 main.py Repl.it: https:/

6 Mar 05, 2022
a small cli to generate AWS Well Architected Reports on the road

well-architected-review This repo intends to publish some scripts related to Well Architected Reviews. war.py extracts in txt & xlsx files all the WAR

4 Mar 18, 2022
An advanced telegram language translator bot

Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/FayasNoushad/Translator-Bot-V3/blob/main/LICE

Fayas Noushad 19 Dec 24, 2022
A simple url uploader bot with permenent thumbnail support

URL-Uploader A simple url uploader bot with permenent thumbnail support Scrapped some code from @SpEcHIDe's AnyDLBot Repository Please fork this repos

Fayas Noushad 40 Nov 29, 2021
Elemeno.ai standard development kit in Python

Overview A set of glue code and utilities to make using elemeno AI platform a smooth experience Free software: Apache Software License 2.0 Installatio

Elemeno AI 3 Dec 14, 2022
Maintained wavelink fork for pycord

Pycord.Wavelink Wavelink is robust and powerful Lavalink wrapper for Pycord! Wavelink features a fully asynchronous API that's intuitive and easy to u

Pycord Development 23 Dec 11, 2022
Frida-based ceserver.iOS analysis is possible with Cheat Engine.

frida-ceserver frida-based ceserver. iOS analysis is possible with Cheat Engine. Original by Dark Byte. Usage Install python library. pip install pack

87 Dec 30, 2022
Discord spam bots with multiple account support and more

Discord spam bots with multiple account support and more. PLEASE READ EVERYTHING BEFORE WRITING AN ISSUE!! Server Messages Text Image Dm Messages Text

Mr. Nobody 6 Sep 14, 2022
Send SMS text messages via email with as many accounts as you want :)

SMS-Spammer Send SMS text messages via email with as many accounts as you want :) Example Set Up Guide! To start log into the gmail account you would

Riceblades11 10 Oct 25, 2022
A simple Python wrapper for the archive.is capturing service

archiveis A simple Python wrapper for the archive.is capturing service. Installation pipenv install archiveis Python Usage Import it. import archi

PastPages 157 Dec 28, 2022