Skip to content

Youngestdev/buycoins-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BuyCoins Python Library

Build Status

The BuyCoins Python library allows interactions with the BuyCoins API from applications written in Python.

Documentation

You can view the documentation for the BuyCoins Python library here.

The official BuyCoins API documentation can be found on the BuyCoins developer portal.

Installation

This package can be installed from PyPi using the command:

pip install buycoins-python

Install from source:

python setup.py install

Requirements

  • Python 3.6+

Usage

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())

Handling Exceptions

The library comes built-in with exception handlers for unsuccessful requests. This is documented in the exceptions page.

Executing your own queries

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)

Contributing

Check CONTRIBUTING.MD

Authors

License

See LICENCE.MD.

Releases

No releases published

Packages

No packages published

Languages