Skip to main content

A convenient way to integrate DV.net to your platform

Project description

DV.net Python Client

A Python client for DV.net API integration.

Documentation

You can find extended documentation at https://docs.dv.net/

Installation

pip install dv-net-client
# For the async client, also install aiohttp
pip install aiohttp

Setup

Synchronous Client

from dv_net_client.client import MerchantClient
# Initialize the client with host and API key
client = MerchantClient(
    host='[https://api.example.com](https://api.example.com)', # Your DV.net API host
    x_api_key='your-api-key'
)

# You can also pass the host and key in each request
# client = MerchantClient()
# client.get_exchange_balances(host='...', x_api_key='...')

Asynchronous Client

import asyncio
from dv_net_client.async_client import AsyncMerchantClient

async def main():
    # Initialize the client
    async_client = AsyncMerchantClient(
        host='[https://api.example.com](https://api.example.com)',
        x_api_key='your-api-key'
    )
    
    # Example call
    balances = await async_client.get_exchange_balances()
    print(balances)

if __name__ == "__main__":
    asyncio.run(main())

Usage

Signature Verification

Verify the authenticity of webhook signatures.

from dv_net_client.utils import MerchantUtilsManager

manager = MerchantUtilsManager()
is_valid = manager.check_sign(
    client_signature='received-signature-hash',
    client_key='your-client-key',
    request_body={'data': 'request-payload'}
)
# Returns True if the signature is valid

Webhook Processing

from dv_net_client.mappers import WebhookMapper

mapper = WebhookMapper()
webhook_data = {'type': 'PaymentReceived', ...} # your webhook data
webhook_dto = mapper.map_webhook(webhook_data)
# Returns a ConfirmedWebhookResponse, UnconfirmedWebhookResponse, or WithdrawalWebhookResponse object

API Call Examples (Synchronous Client)

All methods of the synchronous client have asynchronous counterparts in AsyncMerchantClient.

Get Exchange Balances:

balances = client.get_exchange_balances()
# Returns a TotalExchangeBalanceResponse object

Create External Wallet:

wallet = client.get_external_wallet(
    store_external_id='store-123',
    email='user@example.com',
    ip='127.0.0.1',
    amount='100.00',
    currency='USD'
)
# Returns an ExternalAddressesResponse object

Initialize Withdrawal:

withdrawal = client.initialize_transfer(
    address_to='0x123...',
    currency_id='ETH',
    amount='1.5',
    request_id='unique-request-id'
)
# Returns a WithdrawalResponse object

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dv_net_client-1.0.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dv_net_client-1.0.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file dv_net_client-1.0.0.tar.gz.

File metadata

  • Download URL: dv_net_client-1.0.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.18 Linux/6.11.0-1018-azure

File hashes

Hashes for dv_net_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ae4fef6fd517a4af1ace592b9c3e60e0084ef44af4573bd762704bb60e9c1b0f
MD5 d9bf8f5376b96e9baf21da05f5ff9bba
BLAKE2b-256 ce2176caa3e4be215a060ebcf1aa3b0b37031cfb22b27e725e139aa6591520a7

See more details on using hashes here.

File details

Details for the file dv_net_client-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dv_net_client-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.18 Linux/6.11.0-1018-azure

File hashes

Hashes for dv_net_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc8d6802cea84b763b02f6cb460ffca98069541a62a44b719ef6aeedbcffb5c6
MD5 0b16e389cfe233a725a0752bcd30beaf
BLAKE2b-256 b9273bdbeaa190e31abaa49efe78595597737e5f250eb7d6c3269331cf939a64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page