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 discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create custom messages by telling the bot with Commands.

A discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create cust

Aran 1 Oct 13, 2021
API para realizar parser de frases

NLP API Simple api to parse and apply some preprocessing steps in portuguses phrases (pt_BR) This api uses the great FastAPI and spaCy packages! Usage

⟠ Rodolfo De Nadai 1 Dec 28, 2021
Pdisk Uploader Bot

pdisk-bot pdisk uploader telegram bot How To Use Configs TG_BOT_TOKEN - Get bot token from @BotFather API_ID - From my.telegram.org API_HASH - From my

lokaman chendekar 25 Oct 21, 2022
An API wrapper for Discord written in Python.

discord.py A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using asyn

Danny 12k Jan 08, 2023
Google Sheets Python API v4

pygsheets - Google Spreadsheets Python API v4 A simple, intuitive library for google sheets which gets your work done. Features: Open, create, delete

Nithin Murali 1.4k Jan 08, 2023
Scuttlecrab.py - Python Version of Scuttle Crab Bot

____ _ _ _ ____ _ / ___| ___ _ _| |_|

Fabrizo 4 Jul 08, 2022
Auto-commiter - Auto commiter Github

auto committer Github Follow the steps below to use this repository: 1-install c

Arman Ebtekari 8 Nov 14, 2022
AminoSpamKilla - Spam bot for amino that uses multiprocessing module

AminoSpamKilla Spam bot for amino that uses multiprocessing module Pydroid Open

4 Jun 27, 2022
Python wrapper for Interactive Brokers Client Portal Web API

EasyIB: Unofficial Wrapper for Interactive Brokers API EasyIB is an unofficial python wrapper for Interactive Brokers Client Portal Web API. Features

39 Dec 13, 2022
Add Me To Your Group Enjoy With Me. Pyrogram bot. https://t.me/TamilSupport

SongPlayRoBot 3X Fast Telethon Based Bot ⚜ Open Source Bot 👨🏻‍💻 Demo : SongPlayRoBot 💃🏻 Easy To Deploy 🤗 Click Below Image to Deploy DEPLOY Grou

IMVETRI 850 Dec 30, 2022
Lazy airdrop based on private temporary ids

LobsterDAO This uses a modified MerkleDistributor, which allows to issue a lazy airdrop using temporary IDs. In this example it uses Telegram chat_id

41 Sep 10, 2022
Stock Market Insights is a Dashboard that gives the 360 degree view of the particular company stock

fedora-easyfix A collection of self-contained and well-documented issues for newcomers to start contributing with How to setup the local development e

Ganesh N 3 Sep 10, 2021
Automated endpoint management for Amazon Aurora Global Database

This sample code can be used to manage Aurora global database endpoints. After failover the global database writer endpoints swap from one region to the other. This solution automates creation and ma

AWS Samples 13 Dec 08, 2022
Translates English into Mandalorian (Mando'a) utilizing a "funtranslations" free API

Mandalorian Translator Translates English into Mandalorian (Mando'a) utilizing a "funtranslations" free API About I created this app to experiment wit

Hayden Covington 1 Dec 04, 2021
To dynamically change the split direction in I3/Sway so as to split new windows automatically based on the width and height of the focused window

To dynamically change the split direction in I3/Sway so as to split new windows automatically based on the width and height of the focused window Insp

Ritin George 6 Mar 11, 2022
Code release for "Cycle Self-Training for Domain Adaptation" (NeurIPS 2021)

CST Code release for "Cycle Self-Training for Domain Adaptation" (NeurIPS 2021) Prerequisites torch=1.7.0 torchvision qpsolvers numpy prettytable tqd

31 Jan 08, 2023
An API wrapper for convertio.co written in Python.

An API wrapper for convertio.co written in Python.

Moonrise 9 Sep 27, 2022
The simple way of using Imgur.

PyImgur The simple way of using Imgur. You can upload images, download images, read comments, update your albums, message people and more. In fact, yo

Andreas Damgaard Pedersen 120 Dec 06, 2022
Brute force instagram account / actonetor, 2021

Brute force instagram account / actonetor, 2021

actonetor 6 Nov 16, 2022
A heraldry-related bot, designed for the Heraldry Community.

Heraldtron A heraldry-related bot, designed for the Heraldry Community. Requirements Python 3.9+ discord.py aiohttp (comes installed with discord.py)

1 Mar 31, 2022