# Introduction

The [BuyCoins Python library](https://github.com/Youngestdev/BuyCoins-Python) allows interactions with the BuyCoins API from applications written in Python.

## Installation

Begin by installing the package from the PyPi repository:

```
$ pip install buycoins-python
```

Next, create an **auth\_key** variable in a `.env` file:

```
auth_key=public key:private key
```

> &#x20;If you haven't gotten your public and private key, refer to [this page](https://developers.buycoins.africa/#how-do-i-get-access).

Test your installation from a python console:

```
$ python
>>> from buycoins import Wallet
>>> Wallet().get_balances()
```

If any of the above commands fails, appropriate error messages are displayed.

#### Errors

A 401 error is returned when an invalid `auth_key` value is set:

```javascript
{
    "status": "error",
    "name": "ClientError",
    "code": 401,
    "message": "invalid credentials"
}
```

## What can I do with the library?

The core features of the package are:

1. Buying & Selling supported cryptocurrencies (Bitcoin, Ethereum, Litecoin) using the P2P class.&#x20;
2. Generating deposit bank accounts to top up your [NGNT](https://ngnt.org) account using the NGNT class.
3. Sending supported currencies to external addresses and generating addresses to receive supported currencies using the Wallet class.
4. Verifying webhook events using the Webhook class.

### API

The BuyCoins API is hosted on [BuyCoin's Developer Portal](https://developers.buycoins.africa/).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://buycoins.youngest.dev/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
