This project has been archived by its maintainers, and is no longer receiving any updates.
A Simple python library for coinswitch
This is a simple library that uses coinswitch APIs. It is just a collection of utils to manipulate, interpret and simplify calls to their APIs
How to use
First install the package with pip
pip install coinswitchclient
Then be sure to have your API key. If not it defaults to a sandbox api key There are two major blocks inside this package:
TransactionManager: it is a set of function that call the v2 instant APICoinSwitchV1Client: function that reflect the v1 coinswitch apiCoinSwitchV2FixedClient: function that reflect the v2 fixed coinswitch apiCoinSwitchV2InstantClient: function that reflect the v2 instant coinswitch apiApiResponse: an object that represent the reponse from coinswitch apis
You can find examples inside the test directory of this repo.
Usage of ApiResponse
You never have to crete this object, but it will be return by each api calls. Here is the global structure of an ApiResponse
{
"success": true,
"code": "",
"data": "",
"error": ""
}
The ApiResponse object provide simple method to access basic information
api_response.is_success() # returns a boolean
api_response.code() # return the code string in the "code" field
api_response.message() # returns the content of error or msg depending on the remote response
api_response.data() # return a dict object that represent the data
Please see https://developer.coinswitch.co/ for any information of the returned fields in the data message
Usage for TransactionManager
# import required modules and classes
from coinswitch_client.TransactionManager import TransactionManager
from coinswitch_client.APIClient import Address
# create an instance of the transaction manager
manager = TransactionManager(api_key="MY_API_KEY")
# Ask to convert 1 BTC to ETH with
manager.convert('btc', 'eth', 1.0, Address('ETH_ADDRESS').json(),
Address('REFUND_ADDRESS').json())
#this function returns the response from the coinswitch api as a ApiResponse
Usage for CoinSwitchV1Client
It follows the https://developer.coinswitch.co/ apis Here is a simple usage though
from coinswitch_client.APIClient import CoinSwitchV1Client
client = CoinSwitchV1Client(api_key="MYKEY")
api_response = client.coins()
if api_response.is_success():
print(api_response.data())
Usage for CoinSwitchV2InstantClient
It follows the https://developer.coinswitch.co/ apis Here is a simple usage though
from coinswitch_client.APIClient import CoinSwitchV2InstantClient
client = CoinSwitchV2InstantClient(api_key="MYKEY")
api_response = client.coins()
if api_response.is_success():
print(api_response.data())
api_response = client.rates('btc', 'eth')
if api_response.is_success():
print(api_response.data())
Usage for CoinSwitchV2FixedClient
It follows the https://developer.coinswitch.co/ apis Here is a simple usage though
from coinswitch_client.APIClient import CoinSwitchV2FixedClient
client = CoinSwitchV2FixedClient(api_key="MYKEY")
api_response = client.coins()
if api_response.is_success():
print(api_response.data())
api_response = client.place_offer('btc', 'eth',quantity_from=1.0)
if api_response.is_success():
print(api_response.data())
Metadata
Release files for coinswitchclient 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| coinswitchclient-0.0.2.tar.gz | 6.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| coinswitchclient-0.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 12.6 kB
Release files / coinswitchclient-0.0.2.tar.gz
| Download URL | coinswitchclient-0.0.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a87deab662e022cb6056cf40cf0c4b86a58acada6b8378a64ea52109bc2cfc9b
|
|
BLAKE2b-256 checksum How to use checksums |
4c682b97c81cebc216f254984a0e14958a4a12a9514b467079382030e2a1bac6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
|
Release files / coinswitchclient-0.0.2-py2.py3-none-any.whl
| Download URL | coinswitchclient-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6282e1d8bfb5aa25f3ec5c427678e3675cb8b18a2a48d7110918b1d034891a1e
|
|
BLAKE2b-256 checksum How to use checksums |
c992142bd260f8b1e0265007a89df237514098c6ce4ddea9fefb77f39a3d4fbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
|
Security for coinswitchclient 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.