Skip to main content

Python SDK for the BuyCoin"s API

Project description

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.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

buycoins_python-0.5.2-py3-none-any.whl (15.0 kB view hashes)

Uploaded Python 3

Supported by

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