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

Add raise_exception option to Translator to add workaround for json.decoder.JSONDecodeError #51

Closed
wants to merge 7 commits into from

Conversation

luminousmen
Copy link
Contributor

During translating google API can send you error page back. In my use case this was caused by russian text with emojies. I've this issue with chinese to english translation. Do not really know the underlying reason (I guess it's author's generated token -- cause I get 403 status code), but implement simple workaround for this.

@coveralls
Copy link

coveralls commented Dec 20, 2017

Coverage Status

Coverage decreased (-1.3%) to 97.345% when pulling 741ef01 on luminousmen:master into 8105d07 on ssut:master.

"""

def __init__(self, service_urls=None, user_agent=DEFAULT_USER_AGENT, proxies=None):
Copy link
Owner

Choose a reason for hiding this comment

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

Could you explain me why you removed proxy support instead of just adding an needed argument? I think you did by mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's my mistake - no purpose here

@coveralls
Copy link

coveralls commented Jan 12, 2018

Coverage Status

Coverage decreased (-1.2%) to 97.49% when pulling f415783 on luminousmen:master into 57076b5 on ssut:master.

@kasnitski
Copy link

Hi, guys. Why we do not merge this to the master if it works?

@kasnitski
Copy link

@luminousmen could you please try to fix the coverage?

@luminousmen
Copy link
Contributor Author

@kasnitski done, sorry - already forgot about this PR

@kasnitski
Copy link

@ssut let's merge? what do you think?

@UserUnknownFactor
Copy link

Why not always rise exception? It's on user to decide what to do if the function breaks in some way so those strange motions with DUMMY_DATA and additional parameter seem excessive.

It would be more clear if custom exception were raised with current service_url, error code and text of error page's <title> tag instead.

@ssut ssut mentioned this pull request Jun 10, 2020
@ssut
Copy link
Owner

ssut commented Jun 10, 2020

This has been merged into #181.

@ssut ssut closed this Jun 10, 2020
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

Successfully merging this pull request may close these issues.

5 participants