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
discord token grabber using python

Discord Token Grabber A Discord token grabber written in Python 3. This version of the grabber only supports Windows. Features No local caching Transf

1 Oct 28, 2021
You can connect with Sanila Ranatunga using this bot😉😉

Sanila-Ranatunga-s-Assistant-Bot You can connect with Sanila Ranatunga using this bot 😉 😉 Reach me on Telegram Sanila's Assistant Bot What is Telegr

Sanila Ranatunga 5 Feb 01, 2022
A twitter bot that simply replies with a beautiful screenshot of the tweet, powered by beautify.dhravya.dev

Poet this! Replies with a beautiful screenshot of the tweet, powered by poet.so Installation git clone https://github.com/dhravya/poet-this.git cd po

Dhravya Shah 30 Dec 04, 2022
Bin Checker with Aiogram, Telegram

Bin Checker with Aiogram, Telegram

JEFF 1 Aug 16, 2022
Discord Multitool made in python 3.9

XTool Discord Multitool 24 Features: Webhook Delete VC Lagger Fast Token Checker Mass Report [Not Done] Token rape 2K Characters Bypass Block bypass M

Tiie 50 Dec 20, 2022
Plataforma para atendimento a outras empresas que necessitam de atendimento técnico.

Plataforma para atendimento a outras empresas que necessitam de atendimento técnico. É possível que os usuarios de empresas parceiras registrem solici

Kelvin Alisson Cantarino 2 Jun 29, 2022
A full-fledged discord bot with moderation and a lot more.

HOT-BOT-POL-POT ⭐ Star me on GitHub m'lady.... hot-bot-pol-pot is a moderation discord bot written using enhanced-dpy library with many functionalitie

Pure Cheekbones 4 Oct 08, 2022
Roblox-Account-Gen - A simple account generator not using paid solving services

Roblox Account Generator Star this if it helped to spread awareness! No 2captcha

x 1 Feb 17, 2022
An async python wrapper to interact with the Steam API and its CMs

steam.py A modern, easy to use, and async ready package to interact with the Steam API. Heavily inspired by discord.py and borrowing functionality fro

James Hilton-Balfe 90 Dec 15, 2022
Presentation and code files for the talk at PyCon Indonesia

pycon-indonesia Presentation and code files for the talk at PyCon Indonesia. Files used for the PyCon Indonesia presentation. [Directory Includes:] Be

Neeraj Pandey 2 Dec 04, 2021
Pancakeswap Sniper BOT - TORNADO CASH Proxy (MAC WINDOWS ANDROID LINUX) A fully decentralized protocol for private transactions

TORNADO CASH Proxy Pancakeswap Sniper BOT 2022-V1 (MAC WINDOWS ANDROID LINUX) ⭐️ A fully decentralized protocol for private transactions ⭐️ AUTO DOWNL

Crypto Trader 1 Jan 05, 2022
🤖 A discord bot for Dota2 community

BOTA BOT-A is a free Discord Dota 2 bot which provides comprehensive Information of every Dota 2 characters and exciting features for the community. P

Bendang 23 Jun 29, 2022
pyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Master Server

PyDuinoCoin PyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Main Server. I

BackrndSource 6 Jul 14, 2022
Token-gate Notion pages

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

John 8 Oct 13, 2022
Monetize your apps with KivAds using Google AdMob api.

KivAds(WIP) Monetize your apps with KivAds using Google AdMob api. KivAds uses the latest version of Google AdMob sdk(version 20.0.0). KivAds exposes

Guhan Sensam 16 Nov 05, 2022
Pyspark sam - Analyze Big Sequence Alignments with PySpark in AWS EMR

pyspark_sam This repo hosts my code for the article "Analyze Big Sequence Alignm

Sixing Huang 4 Dec 09, 2022
EduuRobot Telegram bot source code.

EduuRobot A multipurpose Telegram Bot made with Pyrogram and asynchronous programming. Requirements Python 3.6+ An Unix-like operating system (Running

Amano Team 119 Dec 23, 2022
My homeserver setup. Everything managed securely using Portainer.

homeserver-traefik-portainer Features: access all services with free TLS from letsencrypt using your own domain running a side project is super simple

Tomasz Wójcik 44 Jan 03, 2023
A python API for BSCScan (Binance Smart Chain Explorer), available on PyPI.

bscscan-python A complete Python API for BscScan.com, available on PyPI. Powered by BscScan.com APIs. This is a gently modified fork of the etherscan-

Panagiotis Kotsias 246 Dec 31, 2022
A modified Sequential and NLP based Bot

A modified Sequential and NLP based Bot I improvised this bot a bit with some implementations as a part of my own hobby project :) Note: I do not own

Jay Desale 2 Jan 07, 2022