diff --git a/README.md b/README.md index 3f44473..6ee849b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,7 @@ -# bitfinex-api-py (v3-beta) +# bitfinex-api-py Official implementation of the [Bitfinex APIs (V2)](https://docs.bitfinex.com/docs) for `Python 3.8+`. -> **DISCLAIMER:** \ -Production use of v3.0.0b1 (and all future beta versions) is HIGHLY discouraged. \ -Beta versions should not be used in applications which require user authentication. \ -Provide your API-KEY/API-SECRET, and manage your account and funds at your own risk. - ### Features * Support for 75+ REST endpoints (a list of available endpoints can be found [here](https://docs.bitfinex.com/reference)) @@ -20,13 +15,6 @@ Provide your API-KEY/API-SECRET, and manage your account and funds at your own r python3 -m pip install --pre bitfinex-api-py ``` -### Selecting and installing a specific beta version - -It's also possible to select and install a specific beta version: -```console -python3 -m pip install bitfinex-api-py==3.0.0b1 -``` - --- # Quickstart @@ -305,7 +293,7 @@ All contributions are welcome! :D A guide on how to install and set up `bitfinex-api-py`'s source code can be found [here](#installation-and-setup). \ Before opening any pull requests, please have a look at [Before Opening a PR](#before-opening-a-pr). \ -Contributors must uphold the [Contributor Covenant code of conduct](https://github.com/bitfinexcom/bitfinex-api-py/blob/v3-beta/CODE_OF_CONDUCT.md). +Contributors must uphold the [Contributor Covenant code of conduct](https://github.com/bitfinexcom/bitfinex-api-py/blob/master/CODE_OF_CONDUCT.md). ### Index @@ -323,10 +311,8 @@ A brief guide on how to install and set up the project in your Python 3.8+ envir ### Cloning the repository -The following command will only clone the `v3-beta` branch (excluding all others): - ```console -git clone --branch v3-beta --single-branch https://github.com/bitfinexcom/bitfinex-api-py.git +git clone https://github.com/bitfinexcom/bitfinex-api-py.git ``` ### Installing the dependencies diff --git a/bfxapi/_version.py b/bfxapi/_version.py index b6aac9a..528787c 100644 --- a/bfxapi/_version.py +++ b/bfxapi/_version.py @@ -1 +1 @@ -__version__ = "3.0.0b5" +__version__ = "3.0.0" diff --git a/bfxapi/rest/_interface/middleware.py b/bfxapi/rest/_interface/middleware.py index f2e2b83..92967c1 100644 --- a/bfxapi/rest/_interface/middleware.py +++ b/bfxapi/rest/_interface/middleware.py @@ -3,14 +3,14 @@ import json from datetime import datetime from enum import IntEnum -from typing import TYPE_CHECKING, Any, List, Optional +from typing import TYPE_CHECKING, Any, List, NoReturn, Optional import requests from bfxapi._utils.json_decoder import JSONDecoder from bfxapi._utils.json_encoder import JSONEncoder from bfxapi.exceptions import InvalidCredentialError -from bfxapi.rest.exceptions import RequestParametersError, UnknownGenericError +from bfxapi.rest.exceptions import GenericError, RequestParameterError if TYPE_CHECKING: from requests.sessions import _Params @@ -86,28 +86,30 @@ def post( return data - def __handle_error(self, error: List[Any]) -> None: + def __handle_error(self, error: List[Any]) -> NoReturn: if error[1] == _Error.ERR_PARAMS: - raise RequestParametersError( - "The request was rejected with the following parameter" - f"error: <{error[2]}>" + raise RequestParameterError( + "The request was rejected with the following parameter " + f"error: <{error[2]}>." ) if error[1] == _Error.ERR_AUTH_FAIL: raise InvalidCredentialError( - "Cannot authenticate with given API-KEY and API-SECRET." + "Can't authenticate with given API-KEY and API-SECRET." ) if not error[1] or error[1] == _Error.ERR_UNK or error[1] == _Error.ERR_GENERIC: - raise UnknownGenericError( - "The server replied to the request with a generic error with " - f"the following message: <{error[2]}>." + raise GenericError( + "The request was rejected with the following generic " + f"error: <{error[2]}>." ) + raise RuntimeError( + f"The request was rejected with an unexpected error: <{error}>." + ) + def __get_authentication_headers(self, endpoint: str, data: Optional[str] = None): - assert ( - self.__api_key and self.__api_secret - ), "API-KEY and API-SECRET must be strings." + assert self.__api_key and self.__api_secret nonce = str(round(datetime.now().timestamp() * 1_000_000)) diff --git a/bfxapi/rest/exceptions.py b/bfxapi/rest/exceptions.py index b55bc2a..7bc3c67 100644 --- a/bfxapi/rest/exceptions.py +++ b/bfxapi/rest/exceptions.py @@ -1,9 +1,9 @@ from bfxapi.exceptions import BfxBaseException -class RequestParametersError(BfxBaseException): +class RequestParameterError(BfxBaseException): pass -class UnknownGenericError(BfxBaseException): +class GenericError(BfxBaseException): pass diff --git a/setup.py b/setup.py index dcab900..6af03ce 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ author_email="support@bitfinex.com", license="Apache-2.0", classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "License :: OSI Approved :: Apache Software License",