The BuyCoins Python library allows interactions with the BuyCoins API from applications written in Python.
You can view the documentation for the BuyCoins Python library here.
The official BuyCoins API documentation can be found on the BuyCoins developer portal.
This package can be installed from PyPi using the command:
pip install buycoins-python
Install from source:
python setup.py install
- Python 3.6+
The library depends on an authentication key to communicate, send requests and receive responses from the BuyCoins API.
Create a .env
file and set your authentication key in the format below:
auth_key="public key:private key"
If you don't have a public and private key, follow the procedures on How to get access?.
Example usage of the library is:
from buycoins import Wallet
buycoins_user = Wallet()
# Print the account balances of each cryptocurrency the buycoins_user have.
print(buycoins_user.get_balances())
The library comes built-in with exception handlers for unsuccessful requests. This is documented in the exceptions page.
In a situtation where you need to run a query different from what is provided in the library, create an instance of
the BuyCoinsClient
class and run your query:
from buycoins import BuyCoinsClient
# Write your query
query = """
query queryName{
query body
}
"""
# Write your variables if any
variables = {
"x": x,
"y": y
}
# Execute your request
response = BuyCoinsClient()._execute_request(query=query, variables=variables)
# Print the response from the request sent
print(response)
Check CONTRIBUTING.MD
See LICENCE.MD.