I'm trying to process this image provided by messenger-platform API (send-api-reference)
@app.route('/photobot/<path:photo_url>')
def tensor_photobot(photo_url):
file = cStringIO.StringIO(urllib.urlopen(photo_url).read())
img = Image.open(file)
if img:
list_elements = process_image(img)
return json.dumps(list_elements)
But the image is not recognized. Any idea?
Message:
{u'mid': u'mid.$cAAbv-uhIfdVkIn9OVld8TqA6u2Hz', u'seq': 40125, u'attachments': [{u'type': u'image', u'payload': {u'url': u'https://scontent-lht6-1.xx.fbcdn.net/v/t34.0-12/20916840_10214193209010537_198030613_n.jpg?_nc_ad=z-m&oh=3eab9a3a400c7e05fb5b74c391852426&oe=5998B9A8'}}]}
[Reference][1] python 2.x
[1]: https://developers.facebook.com/docs/messenger-platform/send-api-reference/image-attachment
Edit: following comment recommendations, I detected the problem is from url-string truncation.
I added all the implementation for more context.
From my comment in case the answer is needed by anyone in the future:
The query string is being truncated from the URL. To load the image, the entire URL including the query string is required.