Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmhayes3/pmaw
Python Messari API Wrapper (PMAW) is a Python package that enables simple access to the Messari API.
https://github.com/jmhayes3/pmaw
api blockchain cryptocurrency messari python python-requests
Last synced: 7 days ago
JSON representation
Python Messari API Wrapper (PMAW) is a Python package that enables simple access to the Messari API.
- Host: GitHub
- URL: https://github.com/jmhayes3/pmaw
- Owner: jmhayes3
- License: mit
- Created: 2021-11-28T23:08:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-08T04:49:13.000Z (over 1 year ago)
- Last Synced: 2024-11-09T03:32:13.405Z (2 months ago)
- Topics: api, blockchain, cryptocurrency, messari, python, python-requests
- Language: Python
- Homepage:
- Size: 263 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Python Messari API Wrapper (PMAW)
[![build](https://github.com/jmhayes3/pmaw/actions/workflows/ci.yml/badge.svg)](https://github.com/jmhayes3/pmaw/actions/workflows/ci.yml)
PMAW is a Python package that allows for simple access to the [Messari](https://messari.io) API.
PMAW aims to be robust and easy to use while respecting [Messari's API rules](https://messari.io/api/docs).## Installation
```sh
pip install git+https://github.com/jmhayes3/pmaw.git
```## Usage
To get started, create an instance of the ``Messari`` class:
```python
from pmaw import Messarimessari = Messari()
```To authenticate using an API key, pass the key in like so:
```python
messari = Messari(api_key="")
```Or, set the ``X_MESSARI_API_KEY`` environmental variable:
```sh
export X_MESSARI_API_KEY=
```Using the ``messari`` instance you can then interact with the API:
```python
# Get the top 10 assets by market cap.
for asset in messari.assets.top(limit=10):
print(asset.name)# Markets
for market in messari.markets(limit=5):
print(market.exchange_name, market.pair)# Time Series
# News
news = messari.news(limit=10)
for n in news:
print(n.title)
```To check which attributes are available for an object use the ``vars`` function:
```python
asset = messari.asset("eth")
vars(asset)
```## Rate Limits
PMAW handles rate limiting automatically, eliminating the need to introduce sleep calls into code.By default, the rate limit is set to 20 requests per minute (the limit enforced by the API for unauthenticated users).
If an API key is provided, the rate limit is increased to 30 requests per minute.
A custom rate limit can be set using the ``target_rate`` keyword argument when initializing the ``Messari`` class.