Skip to content

Throttling and SDK updates#19

Merged
sergioteula merged 6 commits into
masterfrom
dev-throttling-improvement
Mar 15, 2020
Merged

Throttling and SDK updates#19
sergioteula merged 6 commits into
masterfrom
dev-throttling-improvement

Conversation

@sergioteula
Copy link
Copy Markdown
Owner

I have updated throttling to allow values greater than 1 and also False to disable it. On the other hand, I have removed amightygirl.paapi5-python-sdk as a dependency and added the official SDK directly in the project to allow fixing bugs.

Copy link
Copy Markdown
Contributor

@YPCrumble YPCrumble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sergioteula thanks for this! Just added a review. Would be really nice to start the unit test suite as well - that would help for writing regression tests as we fix bugs.

Comment thread amazon/paapi.py Outdated
Comment thread amazon/paapi.py
else:
self.throttling = float(throttling)
if not self.throttling > 0:
raise ValueError
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sergioteula might be nice to include a message telling the user exactly what the issue is vs. having them need to look at the code to understand why the ValueError occurred. Something like "Throttling cannot be less than or equal to zero". Same thing for the ValueError above.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When an error is raised, the try clause handles the error and throws below error message. I made it like this to avoid repeating the error 3 times.

raise AmazonException('ValueError', 'Throttling should be False or greater than 0')

Comment thread amazon/paapi.py Outdated
Copy link
Copy Markdown
Owner Author

@sergioteula sergioteula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update pull request with some changes. Thanks!

Comment thread amazon/paapi.py
else:
self.throttling = float(throttling)
if not self.throttling > 0:
raise ValueError
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When an error is raised, the try clause handles the error and throws below error message. I made it like this to avoid repeating the error 3 times.

raise AmazonException('ValueError', 'Throttling should be False or greater than 0')

Comment thread amazon/paapi.py Outdated
sergioteula and others added 2 commits March 15, 2020 18:36
Fix TypeError in underlying API when self.pool is None for async request
Copy link
Copy Markdown
Contributor

@YPCrumble YPCrumble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great - thank you @sergioteula !

@sergioteula sergioteula linked an issue Mar 15, 2020 that may be closed by this pull request
@sergioteula sergioteula merged commit c829efa into master Mar 15, 2020
@sergioteula sergioteula deleted the dev-throttling-improvement branch March 15, 2020 18:59
sergioteula added a commit that referenced this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request improvement Improvement on code, but without changing behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError 'NoneType' object is not iterable Allow the user to disable throttling, or to set throttling to a value greater than one.

2 participants