aiocryptopay


Nameaiocryptopay JSON
Version 0.4.6 PyPI version JSON
download
home_pagehttps://github.com/layerqa/aiocryptopay
Summary@cryptobot api asynchronous python wrapper
upload_time2024-10-18 21:07:44
maintainerNone
docs_urlNone
authorlayerqa
requires_python<4.0,>=3.8
licenseMIT
keywords aiocryptopay cryptobot cryptopay cryptopay api cryptobot api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## **[@cryptobot](https://t.me/CryptoBot) asynchronous api wrapper**
**Docs:** https://help.crypt.bot/crypto-pay-api

 - MainNet - [@CryptoBot](http://t.me/CryptoBot)
 - TestNet - [@CryptoTestnetBot](http://t.me/CryptoTestnetBot)


**Install**
``` bash
pip install aiocryptopay
poetry add aiocryptopay
```

**Basic methods**
``` python
from aiocryptopay import AioCryptoPay, Networks

crypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)

profile = await crypto.get_me()
currencies = await crypto.get_currencies()
balance = await crypto.get_balance()
rates = await crypto.get_exchange_rates()
stats = await crypto.get_stats()

print(profile, currencies, balance, rates, stats, sep='\n')
```

**Create, get and delete invoice methods**
``` python
from aiocryptopay import AioCryptoPay, Networks

crypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)

invoice = await crypto.create_invoice(asset='TON', amount=1.5)
print(invoice.bot_invoice_url)

# Create invoice in fiat
fiat_invoice = await crypto.create_invoice(amount=5, fiat='USD', currency_type='fiat')
print(fiat_invoice)

old_invoice = await crypto.get_invoices(invoice_ids=invoice.invoice_id)
print(old_invoice.status)

deleted_invoice = await crypto.delete_invoice(invoice_id=invoice.invoice_id)
print(deleted_invoice)
```

**Create, get and delete check methods**
``` python
# The check creation method works when enabled in the application settings

from aiocryptopay import AioCryptoPay, Networks

crypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)

check = await crypto.create_check(asset='USDT', amount=1)
print(check)

old_check = await crypto.get_checks(check_ids=check.check_id)
print(old_check)

deleted_check = await crypto.delete_check(check_id=check.check_id)
print(deleted_check)
```


**WebHook usage**
``` python
from aiohttp import web

from aiocryptopay import AioCryptoPay, Networks
from aiocryptopay.models.update import Update


web_app = web.Application()
crypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)


@crypto.pay_handler()
async def invoice_paid(update: Update, app) -> None:
    print(update)

async def create_invoice(app) -> None:
    invoice = await crypto.create_invoice(asset='TON', amount=1.5)
    print(invoice.bot_invoice_url)

async def close_session(app) -> None:
    await crypto.close()


web_app.add_routes([web.post('/crypto-secret-path', crypto.get_updates)])
web_app.on_startup.append(create_invoice)
web_app.on_shutdown.append(close_session)
web.run_app(app=web_app, host='localhost', port=3001)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/layerqa/aiocryptopay",
    "name": "aiocryptopay",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "aiocryptopay, cryptobot, cryptopay, cryptopay api, cryptobot api",
    "author": "layerqa",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/8e/33/993bab41241020ee8767d9f5e7d8b20de15bba92bdf3869641352dc3a983/aiocryptopay-0.4.6.tar.gz",
    "platform": null,
    "description": "## **[@cryptobot](https://t.me/CryptoBot) asynchronous api wrapper**\n**Docs:** https://help.crypt.bot/crypto-pay-api\n\n - MainNet - [@CryptoBot](http://t.me/CryptoBot)\n - TestNet - [@CryptoTestnetBot](http://t.me/CryptoTestnetBot)\n\n\n**Install**\n``` bash\npip install aiocryptopay\npoetry add aiocryptopay\n```\n\n**Basic methods**\n``` python\nfrom aiocryptopay import AioCryptoPay, Networks\n\ncrypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)\n\nprofile = await crypto.get_me()\ncurrencies = await crypto.get_currencies()\nbalance = await crypto.get_balance()\nrates = await crypto.get_exchange_rates()\nstats = await crypto.get_stats()\n\nprint(profile, currencies, balance, rates, stats, sep='\\n')\n```\n\n**Create, get and delete invoice methods**\n``` python\nfrom aiocryptopay import AioCryptoPay, Networks\n\ncrypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)\n\ninvoice = await crypto.create_invoice(asset='TON', amount=1.5)\nprint(invoice.bot_invoice_url)\n\n# Create invoice in fiat\nfiat_invoice = await crypto.create_invoice(amount=5, fiat='USD', currency_type='fiat')\nprint(fiat_invoice)\n\nold_invoice = await crypto.get_invoices(invoice_ids=invoice.invoice_id)\nprint(old_invoice.status)\n\ndeleted_invoice = await crypto.delete_invoice(invoice_id=invoice.invoice_id)\nprint(deleted_invoice)\n```\n\n**Create, get and delete check methods**\n``` python\n# The check creation method works when enabled in the application settings\n\nfrom aiocryptopay import AioCryptoPay, Networks\n\ncrypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)\n\ncheck = await crypto.create_check(asset='USDT', amount=1)\nprint(check)\n\nold_check = await crypto.get_checks(check_ids=check.check_id)\nprint(old_check)\n\ndeleted_check = await crypto.delete_check(check_id=check.check_id)\nprint(deleted_check)\n```\n\n\n**WebHook usage**\n``` python\nfrom aiohttp import web\n\nfrom aiocryptopay import AioCryptoPay, Networks\nfrom aiocryptopay.models.update import Update\n\n\nweb_app = web.Application()\ncrypto = AioCryptoPay(token='1337:JHigdsaASq', network=Networks.MAIN_NET)\n\n\n@crypto.pay_handler()\nasync def invoice_paid(update: Update, app) -> None:\n    print(update)\n\nasync def create_invoice(app) -> None:\n    invoice = await crypto.create_invoice(asset='TON', amount=1.5)\n    print(invoice.bot_invoice_url)\n\nasync def close_session(app) -> None:\n    await crypto.close()\n\n\nweb_app.add_routes([web.post('/crypto-secret-path', crypto.get_updates)])\nweb_app.on_startup.append(create_invoice)\nweb_app.on_shutdown.append(close_session)\nweb.run_app(app=web_app, host='localhost', port=3001)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "@cryptobot api asynchronous python wrapper",
    "version": "0.4.6",
    "project_urls": {
        "Documentation": "https://help.crypt.bot/crypto-pay-api",
        "Homepage": "https://github.com/layerqa/aiocryptopay",
        "Repository": "https://github.com/layerqa/aiocryptopay"
    },
    "split_keywords": [
        "aiocryptopay",
        " cryptobot",
        " cryptopay",
        " cryptopay api",
        " cryptobot api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92b45354ac684e54400c4f4d26f1ca559469125601fab3f0a681fcef517880e8",
                "md5": "9c842855beba5d6922f4efc2bc76cf8d",
                "sha256": "4481e313e7d568cc1b9be16ac781c363bc10f0a97e72b9f2ced1f5f62c25a6c4"
            },
            "downloads": -1,
            "filename": "aiocryptopay-0.4.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c842855beba5d6922f4efc2bc76cf8d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 14390,
            "upload_time": "2024-10-18T21:07:42",
            "upload_time_iso_8601": "2024-10-18T21:07:42.681378Z",
            "url": "https://files.pythonhosted.org/packages/92/b4/5354ac684e54400c4f4d26f1ca559469125601fab3f0a681fcef517880e8/aiocryptopay-0.4.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e33993bab41241020ee8767d9f5e7d8b20de15bba92bdf3869641352dc3a983",
                "md5": "c23ab8082fb4a698f6235dda43090a5e",
                "sha256": "16a31c100d26d626e89d2c8e7e2181de5abf1bff70081d5c615e23a6306aed2b"
            },
            "downloads": -1,
            "filename": "aiocryptopay-0.4.6.tar.gz",
            "has_sig": false,
            "md5_digest": "c23ab8082fb4a698f6235dda43090a5e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 10823,
            "upload_time": "2024-10-18T21:07:44",
            "upload_time_iso_8601": "2024-10-18T21:07:44.639315Z",
            "url": "https://files.pythonhosted.org/packages/8e/33/993bab41241020ee8767d9f5e7d8b20de15bba92bdf3869641352dc3a983/aiocryptopay-0.4.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-18 21:07:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "layerqa",
    "github_project": "aiocryptopay",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "aiocryptopay"
}
        
Elapsed time: 0.50320s