Skip to content

Commit

Permalink
Merge pull request #170 from bybit-exchange/improve_error_message
Browse files Browse the repository at this point in the history
improve IP rate limit error message
  • Loading branch information
dextertd authored Oct 9, 2023
2 parents 852a3f5 + 317032d commit 1983fba
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pybit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "5.6.0"
VERSION = "5.6.1"
2 changes: 1 addition & 1 deletion pybit/_http_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
4 changes: 2 additions & 2 deletions pybit/legacy/_http_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1983fba

Please sign in to comment.