Re: Error In querying Genderize.io. Can someone please help

2016-12-01 Thread John Gordon
In  handa...@gmail.com 
writes:

> import requests
> import json
> names={'katty','Shean','Rajat'};
> for name in names:
> request_string="http://api.genderize.io/?"+name
> r=requests.get(request_string)
> result=json.loads(r.content)

You're using http: instead of https:, and you're using ?katty instead
of ?name=katty, and therefore the host does not recognize your request
as an API call and redirects you to the normal webpage.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

-- 
https://mail.python.org/mailman/listinfo/python-list


Error In querying Genderize.io. Can someone please help

2016-12-01 Thread handar94
import requests
import json
names={'katty','Shean','Rajat'};
for name in names:
request_string="http://api.genderize.io/?"+name
r=requests.get(request_string)
result=json.loads(r.content)


Error---
Traceback (most recent call last):
  File "C:/Users/user/PycharmProjects/untitled7/Mis1.py", line 7, in 
result=json.loads(r.content)
  File "C:\Users\user\Anaconda2\lib\json\__init__.py", line 339, in loads
return _default_decoder.decode(s)
  File "C:\Users\user\Anaconda2\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\user\Anaconda2\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Can someone please help.
-- 
https://mail.python.org/mailman/listinfo/python-list