commit a1196a83ea919ceae70d3d95b59508317300fbc4 Author: ms lev Date: Wed Dec 1 14:51:19 2021 +0500 create a test version diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a94f409 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__/ +t.py +/venv +README.md \ No newline at end of file diff --git a/python_qiwi/__init__.py b/python_qiwi/__init__.py new file mode 100644 index 0000000..0dd9eee --- /dev/null +++ b/python_qiwi/__init__.py @@ -0,0 +1 @@ +import python_qiwi diff --git a/python_qiwi/python-qiwi.py b/python_qiwi/python-qiwi.py new file mode 100644 index 0000000..af18e8b --- /dev/null +++ b/python_qiwi/python-qiwi.py @@ -0,0 +1,76 @@ + +import requests +import time +import random +import string + + +class QiwiWwаllet(): + + def __init__(self, phone, api_token): + self.s = requests.Session() + self.s.headers['authorization'] = 'Bearer ' + api_token + self.phone = phone + + def pay(self, to_qw, sum_p2p, comment=''): + sum_p2p = str(int(sum_p2p)) + '.00' + self.s.headers = { + 'content-type': 'application/json', + 'User-Agent': 'Android v3.2.0 MKT', + 'Accept': 'application/json', + } + + postjson = {"id": str(int(time.time() * 1000)), "sum": { + "amount": '2.00', "currency": "643" + }, "paymentMethod": { + "type": "Account", "accountId": "643" + }, "comment": str(comment), "fields": {"account": to_qw}} + res = self.s.post( + 'https://edge.qiwi.com/sinap/api/v2/terms/99/payments', + json=postjson) + return res.json() + + def payment_history(self, rows_num=5): + parameters = {'rows': str(rows_num), 'nextTxnId': '', 'nextTxnDate': ''} + h = self.s.get('https://edge.qiwi.com/payment-history/v2/persons/' + + self.phone + '/payments', params=parameters) + return h.json() + + def bill(self): + letters = string.ascii_lowercase + return ''.join(random.choice(letters) for i in range(7)) + + def check(self, comment): + lastPayments = self.payment_history(20) + for payment in lastPayments: + qcomment = payment['comment'] + if comment in qcomment: + return True + return False + + def full_balance(self): + + self.s.headers['Accept'] = 'application/json' + + b = self.s.get( + 'https://edge.qiwi.com/funding-sources/v2/persons/' + self.phone + + '/accounts') + return b.json() + + def balance(self): + self.s.headers['Accept'] = 'application/json' + + b = self.s.get( + 'https://edge.qiwi.com/funding-sources/v2/persons/' + self.phone + '/accounts') + b = b.json() + b = b['accounts'][0]['balance']['amount'] + + return b + + def get_profile(self): + + self.s.headers['Accept'] = 'application/json' + + p = self.s.get( + 'https://edge.qiwi.com/person-profile/v1/profile/current?authInfoEnabled=true&contractInfoEnabled=true&userInfoEnabled=true') + return p.json() diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..5daf14f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[egg_info] +tag_build = +tag_date = 0 \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..503ed96 --- /dev/null +++ b/setup.py @@ -0,0 +1,48 @@ +from io import open +from setuptools import setup + +""" +:authors: Peopl3s +:license: Apache License, Version 2.0, see LICENSE file +:copyright: (c) 2021 Peopl3s +""" + +version = '1.0.2' + +with open('README.md', encoding='utf-8') as f: + long_description = f.read() + +setup( + name='python_qiwi', + version=version, + + author='Levman5', + author_email='lev_bariakh@icloid.ru', + + description=( + u'Module for qiwi wallet api'), + long_description=long_description, + long_description_content_type='text/markdown', + + url='https://github.com/Peopl3s/club_house_api', + download_url='https://github.com/Peopl3s/club-house-api/archive/main.zip', + + license='Apache License, Version 2.0, see LICENSE file', + + packages=['club_house_api'], + install_requires=['aiohttp', 'aiofiles'], + + classifiers=[ + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: OS Independent', + 'Intended Audience :: End Users/Desktop', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Programming Language :: Python :: Implementation :: CPython', + ] +) \ No newline at end of file