Aiocmcapi

Latest version: v0.7.3

Safety actively analyzes 689550 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.2.3

Init

- deleted _currency.CurrenciesList_ import, import example:
py
from aiocmcapi.currency import CurrenciesList


Currency

_CurrenciesList_
- now have [update_api_key] attr to update currencies, init example:
py
currencies = CurrenciesList(
cmc_ids=[1, 1027],
update_api_key="YOUR_API_KEY_HERE"
)


- added [update, update_all] methods:

py
CurrenciesList.update(c_list_id: int) updates currency in list with id in arg
CurrenciesList.update_all() updates all currencies in list


- deleted old [update] method

Other
- updated README.md, pyproject.toml

0.2.2

Exceptions
- renamed exceptions

Client
- _client.get_ now raises EndpointNotFound if response have `'statusCode' == 404`

Currency

- _Meta_ class renamed to _CurrencyMeta_
- created _CurrenciesList_ utility, use example:

py
import asyncio

from aiocmcapi import CurrenciesList

async def main():
currencies = CurrenciesList([1, 1027])
await currencies.update(
api_key="YOUR_API_KEY_HERE"
)

currencies[0] -> Currency(cmc_id=1)
currencies[1] -> Currency(cmc_id=1027)
btc = currencies[0]
eth = currencies[1]

print(f"{btc.name}\n{eth.name}")

if __name__ == "__main__":
asyncio.run(main())


Output:


Bitcoin
Ethereum

0.2.1

exceptions
- created EndpointNotFoundError, ResponseDataError exceptions
Currency
- _Currency.update_: if json-parsed response(r) from _client.Client.get_ have not 'data' key. raises ResponseDataError, example for invalid API key:
`aiocmcapi.exceptions.ResponseDataError: CMC API Error 1001: This API Key is invalid.`
Client
- _Client.get_: if json-parsed response(r) have not 'status' key, raises EndpointNotFoundError, example:
`aiocmcapi.exceptions.EndpointNotFoundError: 'not/existent/endpoint' endpoint not found, json-parsed response have not 'status' key`

0.2

- deleted [name, symbol, price, market_cap] attrs from _currency.Currency_
- renamed _client.APIClient_ to _client.Client_
- added _close_ boolean arg to _client.Client.get_; if =True client will close his session after getting response
- renamed _currency.Currency.update_data_ method to _currency.Currency.update_
- added _getattr_ magic method to _currency.Currency_ to get currency attrs without defining them, example:
python
name = Currency.name as Currency.data['name']

- Example for quotes:
python
price = Currency.quote['USD']['price'] as Currency.data['quote']['USD']['price']
market_cap = Currency.quote['USD']['market_cap'] as Currency.data['quote']['USD']['market_cap']

- added [meta] attr to _currency.Currency_ as _currency.Meta_ class object
- _currency.Currency.update_ calls _currency.Currency.meta.update_ method
- created _currency.Meta_ class with _update_ method instead _currency.Currency.update_meta_(deleted) and _getattr_ magic method to get attrs without defining them, example:
python
name = Currency.meta.name as Currency.meta.data['name']

- Example for website:
python
website = Currency.meta.urls['website'][0] as Currency.meta.data['urls']['website'][0]

- updated pyproject.toml and README.md

0.1.2

- added [meta] attr to _currency.Currency_ as currency metadata dict and _update_meta_ method to update it
- updated pyproject.toml and README.md

0.1.1

- added [slug, symbol] attrs to _currency.Currency_
- updated README.md

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.