I have problems with this ...
You can get the same result as in http://i.joyton.com:2010 Using this image.
and other parameters are saved by default.
def search_img(item, image_name): try: f = open(image_name, 'rb') img = f.read() print type(img) except IOError, e: print 'fail to open %s' % image_name print e return None ts = str(time.time()) m = md5.new('testsearch_by_image' + item) m.update(ts) m.update('0123456789') sign = m.hexdigest() params = urllib.urlencode( { 'item': item, 'app_key': 'test', 'cmd':'search_by_image', 'sign':sign, 'img_file':img, 'extra':'', 'time_stamp':ts, }) headers = {'Content-type': 'application/x-www-form-urlencode', 'Accept': 'text/plain'} conn = httplib.HTTPConnection('i.joyton.com', 2010) conn.request('POST', '', params, headers) response = conn.getresponse() print response.status, response.reason print response.read() conn.close() return response.read() if __name__ == '__main__': search_img('book', 'f:\\book_001.jpg')
Everything works fine in the browser, but my script is not. Sometimes a script returns the correct result; sometimes he gets other books, sometimes he doesn't get anything. When he receives other books, these books are usually searched by other people.
source share