Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error and suggest #28

Closed
yroovtc1 opened this issue Feb 24, 2024 · 2 comments
Closed

Error and suggest #28

yroovtc1 opened this issue Feb 24, 2024 · 2 comments

Comments

@yroovtc1
Copy link

Keep getting this error after a while. Can you add an option to resume at a selected page to avoid wasting time running from the beginning?

Traceback (most recent call last):
File "buff2steam_main_.py", line 85, in
File "asyncio\runners.py", line 44, in run
File "asyncio\base_events.py", line 649, in run_until_complete
File "buff2steam_main_.py", line 79, in main
File "buff2steam_main_.py", line 14, in main_loop
File "buff2steam\provider\buff.py", line 68, in get_items
File "buff2steam\provider\buff.py", line 55, in request
buff2steam.exceptions.BuffError: {'error': '访问频率过高, 请稍后重试……', 'code': 'System Error'}
[14428] Failed to execute script 'main' due to unhandled exception!

And can you add a feature like sort by quantity, to compare the high quantity item first?
image

@volodymyrzuyev
Copy link
Contributor

The error you are getting is related to the buff API rate limit. You should increase the request_interval value in buff portion of config.json. Alternatively, you can set up a try catch in the __main__.py file.

As far as I know buff API does not provide a way to sort goods by quantity, or other metrics, so it would probably be difficult to implement your proposed feature

hldh214 added a commit that referenced this issue Feb 26, 2024
The constructor for the Buff class has been revised to take in the full config object instead of individual parameters. The constructor's parameters (request_interval and request_kwargs) have been replaced with a single config parameter. This helps to simplify code and improve the maintainability. Also, a new attribute 'sort_by' is added to the Buff class and the relevant configuration is provided(#28).

Signed-off-by: hldh214 <hldh214@gmail.com>
@hldh214
Copy link
Owner

hldh214 commented Feb 26, 2024

As far as I know buff API does not provide a way to sort goods by quantity, or other metrics, so it would probably be difficult to implement your proposed feature

The API does indeed support such parameters, as we are utilizing the same API as their website. Therefore, our scripts can perform the same functions as their website.

For years, I believed this project was dead, but it's surprising to see everyone's enthusiasm. Perhaps I should consider recommitting my energy to this project.

hldh214 added a commit that referenced this issue Feb 26, 2024
Added a retry mechanism to the Buff class's request method, in the event of a BuffError exception, using the tenacity library. It is set to try a maximum of 5 times, utilizing a random exponential wait strategy with a minimum of 8 seconds and maximum of 60 seconds between attempts, enhancing error tolerance and stability of data fetching operations.

Signed-off-by: hldh214 <hldh214@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants