Reputation: 11
Here is the code i used:
conn = httplib.HTTPSConnection('api.projectoxford.ai')
conn.request("POST", "/vision/v1.0/ocr?%s" % params,"{'Url':'my_url_xxxxxxxxxx'}", headers_1)
response = conn.getresponse()
data = response.read()
print(data)
This is the error I got:
{
"code":"InvalidImageUrl",
"requestId":"3e074556-dd52-4965-b250-e821b7fb6c27",
"message":"Image URL is not accessible."
}
Upvotes: 0
Views: 1129
Reputation: 11
The error got corrected. I used small cps 'url' instead of "Url" and also changed type to json
headers_1 = { 'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': '*************************' #My valid Key }
conn = httplib.HTTPSConnection('api.projectoxford.ai') conn.request("POST", "/vision/v1.0/ocr?%s" % params,"{'url':'my_url_xxxxxxxxxx'}", headers_1) response = conn.getresponse() data = response.read() print(data)
Upvotes: 0
Reputation: 2973
Your payload needs to be properly cased: "{'url':'https://s-media-cache-ak0.pinimg.com/originals/8c/1b/82/8c1b825d2d0750957098c8a4a879d53f.jpg'}"
, note lower-case url
, not Url
.
Upvotes: 1