analitics

Pages

Friday, April 12, 2019

Using pytineye to automate searching for images.

The TinEye API is ideally suited for image and profile verification, UGC moderation, copyright compliance and fraud detection.
Read more about the TinEye API here.
You need to use authentication for this API, read here.
To use the TinEye API you must purchase a search bundle.
The documentation for Python can be found here.
Let's start with the installation.
You need to download the zip file from GitHub and install using the pip tool:
C:\Python373\Scripts>pip3.7.exe install pytineye-master.zip
...
Successfully installed pytineye-1.3

>>> import pytineye
>>> from pytineye import TinEyeAPIRequest
>>> myapi = TinEyeAPIRequest('http://api.tineye.com/rest/', 'your_public_key', 'your_private_key')
>>> myapi.remaining_searches()
{'bundles': [], 'total_remaining_searches': 0}
Because I don't have search the python code return an error:
>>> myapi.search_url(url='http://en.es-static.us/upl/2019/03/rogue-planet-CFBD-S
IR-J214947.2-040308.9-2012-800x450.jpg')
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python373\lib\site-packages\pytineye\api.py", line 304, in search_url

    obj = self._request('search', params, **kwargs)
  File "C:\Python373\lib\site-packages\pytineye\api.py", line 276, in _request
    raise TinEyeAPIError(obj['code'], obj.get('messages'))
pytineye.exceptions.TinEyeAPIError: APIError:
                   code    = 401
                   message = ['AUTHORIZATION_ERROR', 'You have no more searches
available. Please purchase another bundle if you wish to make more searches.']
If you want to buy TinEye API searches then the prices start from:
5,000 searches $200.00 USD($0.04 per search)
10,000 searches $300.00 USD($0.03 per search)
50,000 searches $1,000.00 USD($0.02 per search)
1,000,000 searches $10,000.00 USD($0.01 per search)