From 317032d22257aeb75f36d2a8917451a2eaf0d371 Mon Sep 17 00:00:00 2001 From: dextertd Date: Mon, 9 Oct 2023 20:18:47 +0100 Subject: [PATCH] improve IP rate limit error message --- CHANGELOG.md | 5 +++++ pybit/__init__.py | 2 +- pybit/_http_manager.py | 2 +- pybit/legacy/_http_manager.py | 4 ++-- setup.py | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca891a9..1ba8ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.6.1] - 2023-10-09 +### Changed +- Improved the IP rate limit error message to indicate that an HTTP status code 403 may also mean that the IP address was identified as being from the USA – all requests from USA IPs are [banned](https://t.me/BybitAPI/180420) by Bybit. + + ## [5.6.0] - 2023-09-28 ### Added - Add RSA authentication for HTTP and WebSocket (choose "Self-generated API Keys" when [creating](https://testnet.bybit.com/app/user/api-management) an API key) diff --git a/pybit/__init__.py b/pybit/__init__.py index 1cf2c24..560fd73 100644 --- a/pybit/__init__.py +++ b/pybit/__init__.py @@ -1 +1 @@ -VERSION = "5.6.0" +VERSION = "5.6.1" diff --git a/pybit/_http_manager.py b/pybit/_http_manager.py index 95400cb..8757041 100644 --- a/pybit/_http_manager.py +++ b/pybit/_http_manager.py @@ -280,7 +280,7 @@ def _submit_request(self, method=None, path=None, query=None, auth=False): # Check HTTP status code before trying to decode JSON. if s.status_code != 200: if s.status_code == 403: - error_msg = "You have breached the IP rate limit." + error_msg = "You have breached the IP rate limit or your IP is from the USA." else: error_msg = "HTTP status code is not 200." self.logger.debug(f"Response text: {s.text}") diff --git a/pybit/legacy/_http_manager.py b/pybit/legacy/_http_manager.py index d4f6e39..a167cdf 100644 --- a/pybit/legacy/_http_manager.py +++ b/pybit/legacy/_http_manager.py @@ -300,7 +300,7 @@ def _submit_request(self, method=None, path=None, query=None, auth=False): # Check HTTP status code before trying to decode JSON. if s.status_code != 200: if s.status_code == 403: - error_msg = "You have breached the IP rate limit." + error_msg = "You have breached the IP rate limit or your IP is from the USA." else: error_msg = "HTTP status code is not 200." self.logger.debug(f"Response text: {s.text}") @@ -805,7 +805,7 @@ def _submit_request(self, method=None, path=None, query=None, auth=False): # Check HTTP status code before trying to decode JSON. if s.status_code != 200: if s.status_code == 403: - error_msg = "You have breached the IP rate limit." + error_msg = "You have breached the IP rate limit or your IP is from the USA." else: error_msg = "HTTP status code is not 200." self.logger.debug(f"Response text: {s.text}") diff --git a/setup.py b/setup.py index 7290702..2615a76 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='pybit', - version='5.6.0', + version='5.6.1', description='Python3 Bybit HTTP/WebSocket API Connector', long_description=long_description, long_description_content_type="text/markdown",