You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could cache the result of this call to disk, or refactor so that it isn't called as often per run (preferable in case bot moves between geographic locations between runs)
Could also switch to some other library that doesn't rate limit as much
i tried ipinfo it works fine. here is the code i generated from chatgpt 😭
@staticmethod
def getCCodeLang(lang: str, geo: str) -> Tuple:
if lang is None or geo is None:
try:
response = requests.get("https://ipinfo.io/json")
nfo = response.json()
print(nfo)
except requests.RequestException:
logging.warning(
"Returning default due to API request failure", exc_info=True
)
return "vi", "VN"
if isinstance(nfo, dict):
if lang is None:
lang = nfo.get("languages", "vi").split(",")[0].split("-")[0]
if geo is None:
geo = nfo.get("country", "VN")
return lang, geo
Before submitting a bug report...
This bug wasn't already reported.
(I have checked every bug report on GitHub)
I've cleared the sessions folder.
Branch
master
Commit
c9bc044
Describe the bug
When running the script multiple times a day (because of crashes) eventually the ipapi library will rate limit you for the rest of that day
Copy and paste your error
2024-08-31 11:52:32,433 [INFO] [BING] Finished Desktop Edge Bing searches !
2024-08-31 11:53:11,378 [WARNING] Returning default
Traceback (most recent call last):
File "C:\repos\MS-Rewards-Farmer\src\browser.py", line 207, in getCCodeLang
nfo = ipapi.location()
^^^^^^^^^^^^^^^^
File "C:\repos\MS-Rewards-Farmer.venv\Lib\site-packages\ipapi\ipapi.py", line 87, in location
raise RateLimited(data)
ipapi.exceptions.RateLimited: {'error': True, 'reason': 'RateLimited', 'message': 'Visit https://ipapi.co/ratelimited/ for details'}
Screenshots
None
Value of dashboard variable
None
The text was updated successfully, but these errors were encountered: