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
Ой, братишка! Greetings from Brazil. Your API has been of great use to me. I'm using it to create material to study Russian on Anki. There was a little problem where if you made a request for translation samples for an entry that is not available on Reverso Context it would never stop doing the request, and then the server would inevitably throw a 429 exception (and if this kept happening your IP would be temporarily blocked from making requests, which is awful). Same thing would happen if you asked for a number of samples for a given word, but the number of available samples on Reverso Context for that word is smaller than the number you requested.
Anyway, my solution is not the most elegant but I think it solves the problem.
Паоло, привет!)
Thank you for the pull request, I haven't bumped into this problem before. Also it's nice to hear that this package was of some value to you, thanks)
I think the good place for this change is in _translations_pager as it's responsible for iteration of results. You could stop the pager by just 'raise StopIteration()' to avoid changing the result type of get_translation_samples
Hello, Alexander! I have done what you suggested. I put a break statement in the _translations_pager instead of using StopIteration(), however. I tried doing it the way you proposed, but then it throws a runtime exception if StopIteration() is explicitly stated. The generator never actually gets to the end because it keeps returning empty lists (which the other function keeps scanning for content that is never found), so it seemed to me to be necessary to kill it from outside. The runtime exception could be handled, but I figured it would become too bulky to do it that way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ой, братишка! Greetings from Brazil. Your API has been of great use to me. I'm using it to create material to study Russian on Anki. There was a little problem where if you made a request for translation samples for an entry that is not available on Reverso Context it would never stop doing the request, and then the server would inevitably throw a 429 exception (and if this kept happening your IP would be temporarily blocked from making requests, which is awful). Same thing would happen if you asked for a number of samples for a given word, but the number of available samples on Reverso Context for that word is smaller than the number you requested.
Anyway, my solution is not the most elegant but I think it solves the problem.