pytineye - Python client for TinEye API

pytineye is a Python client for the TinEye API.

TinEyeAPIRequest

class pytineye.TinEyeAPIRequest(api_url='http://api.tineye.com/rest/', public_key=None, private_key=None)

Class to ease communication with the TinEye API server.

Establish a connection to the API:

>>> from pytineye import TinEyeAPIRequest
>>> api = TinEyeAPIRequest('http://api.tineye.com/rest/', 'your_public_key', 'your_private_key')

Searching for an image using an image URL:

>>> api.search_url(url='http://www.tineye.com/images/meloncat.jpg')
TinEyeResponse(...)

Searching for an image using image data:

>>> fp = open('meloncat.jpg', 'rb')
>>> data = fp.read()
>>> api.search_data(data=data)
TinEyeResponse(...)
>>> fp.close()

Getting information about your search bundle:

>>> api.remaining_searches()
{'expire_date': datetime.datetime(2012, 9, 28, 11, 11, 31),
 'remaining_searches': 854,
 'start_date': datetime.datetime(2011, 9, 29, 11, 11, 31)}

Getting an image count:

>>> api.image_count()
2180913080
image_count(**kwargs)

Lists the number of indexed images on TinEye.

Returns: TinEye image count.

remaining_searches(**kwargs)

Lists the number of searches you have left in your current active block.

Returns: a dictionary with remaining searches, start time and end time of block.

search_data(data, offset=0, limit=100, sort='score', order='desc', **kwargs)

Perform searches on the TinEye index using image data.

  • data, image data to use for searching.
  • offset, offset of results from the start, defaults to 0.
  • limit, quantity of results to return, defaults to 100.
  • sort, sort results by score, file size (size), or crawl date (crawl_date), defaults to desc.
  • order, sort results by ascending (asc) or descending criteria.

Returns: a TinEye Response object.

search_url(url, offset=0, limit=100, sort='score', order='desc', **kwargs)

Perform searches on the TinEye index using an image URL.

  • url, the URL of the image that will be searched for, must be urlencoded.
  • offset, offset of results from the start, defaults to 0.
  • limit, quantity of results to return, defaults to 100.
  • sort, sort results by score, file size (size), or crawl date (crawl_date), defaults to desc.
  • order, sort results by ascending (asc) or descending criteria.

Returns: a TinEye Response object.

TinEyeResponse

class pytineye.TinEyeResponse(matches)

Represents a response from the API.

Attributes:

  • matches, a list of Match objects.

Match

class pytineye.Match(image_url, width, height, size, format, filesize, overlay, contributor, backlinks=None)

Represents an image match.

Attributes:

  • image_url, link to the result image.
  • width, image width in pixels.
  • height, image height in pixels.
  • size, image area in pixels.
  • format, image format.
  • filesize, image size in bytes.
  • overlay, overlay URL.
  • backlinks, a list of Backlink objects pointing to the original websites and image URLs.
  • contributor, whether this is a TinEye contributor image.

Table Of Contents