I want to send some (about 200k) request to Google Input API
and display results. For example I want to send deep
and it must return:
["deep","dépenses","dépend","dépendance","dépendant"]
I tried following script but it's not helpful:
def request(word):
url = 'https://inputtools.google.com/request?text=' + word + '&itc=fr-t-i0-und&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test'
conn = http.client.HTTPConnection(url)
res = conn.getresponse()
print(res.status, res.reason)
I want to know how can achieve that? (see an example of what I want to achieve here)
I'm not sure where you got your call syntax, but if you read the documentation, you'll see that you need to write you code as
import http.client
def request(word):
conn = http.client.HTTPSConnection('inputtools.google.com')
conn.request('GET', '/request?text=' + word + '&itc=fr-t-i0-und&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test')
res = conn.getresponse()
print(res.status, res.reason)
print(res.read())
request(word='deep')