Skip to main content

Python wrapper around Live Coin Watch API

Project description

LiveCoinWatch API wrapper

Python3 wrapper around the LiveCoinWatch API

PyPi Version GitHub

Installation

PyPI

pip install pylivecoinwatch

or from source

git clone https://github.com/PlayErphil/pylivecoinwatch.git
cd pylivecoinwatch
python3 setup.py install

Usage

Create the class.

from pylivecoinwatch import LiveCoinWatchAPI
lcw = LiveCoinWatchAPI("<YOUR_API_KEY>")

The package has no API key, so make sure to get one from the API playground and pass it as a parameter when creating the class.

API Key Error

If your API key is wrong or you didn't specify one, the class will raise 401 Error.

401 Error example:

>>> from pylivecoinwatch import LiveCoinWatchAPI
>>> lcw = LiveCoinWatchAPI()
>>> lcw.overview()

Traceback (most recent call last):

raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.livecoinwatch.com/overview

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

ValueError: {'error': {'code': 401, 'status': 'Unauthorized', 'description': 'The requester is not authorized to access the resource. This is similar to 403 but is used in cases where authentication is expected but has failed or has not been provided.'}}

If you wished to change your API key at any point you can use the following function:

lcw.set_api_key("<NEW_API_KEY>")
# This will change your API key to <NEW_API_KEY>

Usage

The required parameters for each endpoint are defined as required (mandatory) parameters for the corresponding functions. Any optional parameters can be passed using same names, as defined in LiveCoinWatch API Documentation

**Note that it returns a response object from the request library

Usage examples:

>>> lcw.status

VERSION 0.2

  • Functions now return dict
  • Tests implemented with new API

VERSION 0.1

  • All endpoints added
  • Tests implemented
  • First release

Project details


Download files

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

Source Distribution

pylivecoinwatch-0.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

pylivecoinwatch-0.2-py3-none-any.whl (5.7 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