8

I am experiencing some problems using the TextBlob library. I'm trying to run a very simple piece of code like this:

from textblob import TextBlob
text = 'this is just a test'
blob = TextBlob(text)
blob.detect_language()

And it continually gives me this error:

/usr/lib/python3.7/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
    647 class HTTPDefaultErrorHandler(BaseHandler):
    648     def http_error_default(self, req, fp, code, msg, hdrs):
--> 649         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    650 
    651 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 404: Not Found

What is the problem? I have tried it on several devices and it gives me the same error every time.

1
  • I am getting HTTPError: HTTP Error 400: Bad Request every time. I don't think its useful. Commented Jul 22, 2022 at 18:30

1 Answer 1

11

Function dectect_language() sends a request to google translate service:
http://translate.google.com/translate_a/t?client=webapp&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&ssel=0&tsel=0&kc=1&sl=auto&tk=276174.132528
and this url returns 404.

From documentation on detect_language()

Deprecated since version 0.16.0: Use the official Google Translate API instead.

I wouldn't count on this function to be working in the future.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.