Module API Documentation

If you are looking for information on a specific function, class or method, this part of the documentation is for you.

Main model

class visualsnoop.models.Collection(public_key, secret_key, endpoint='http://visualsnoop.com/api/v1', proxies=None, max_retries=2)[source]

Represents a VisualSnoop Collection identified by public_key.

Parameters:
  • public_key – Public key generated for a collection on VisualSnoop Keys page.
  • secret_key – Secret key associated with the public key.
  • endpoint – Base URL for the API calls. It must be an valid URL including protocol, domain and path.
  • proxies – Python Requests compatible proxies dictionary.
  • max_retries (int) – The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections.
add_image(image, image_id=None, update_existing=False, timeout=None)[source]

Adds image to collection, in overwrite-safe manner.

This method sends image data. Use argument image_id to specify your own ID for the image. If image_id is None a unique ID will be generated and returned in the response as a value for key image_id. Make sure to save the image_id value from the API response.

The image with image_id will not be overwritten if parameter update_existing is False (default). To update an existing image with image_id, set update_existing to True.

Parameters:
  • image (file or str) – A file object with image data or a path to a file on filesystem.
  • image_id – (optional) A unique ID of an image. It will be self generated if omitted.
  • update_existing (bool) – A flag whether to allow overwriting existing images.
  • timeout (float or tuple) – (optional) How long to wait for the server to send data before giving up, as a float, or a Python Requests timeout tuple.
delete_image(image_id, timeout=None)[source]

Remove image with image_id from collection.

Parameters:
  • image_id – ID of an image previously added to the collection.
  • timeout (float or tuple) – (optional) How long to wait for the server to send data before giving up, as a float, or a Python Requests timeout tuple.
get_image(image_id, timeout=None)[source]

Retrieve information about indexed image with image_id.

Parameters:
  • image_id – ID of an image previously added to the collection.
  • timeout (float or tuple) – (optional) How long to wait for the server to send data before giving up, as a float, or a Python Requests timeout tuple.
get_images(start=None, count=None, timeout=None)[source]

List images in collection sorted by time.

Parameters:
  • start – Image ID from which to start the listing.
  • count – Number of images in listing.
search_images(image, timeout=None)[source]

Perform search over collection based on image sent in the request body.

Parameters:
  • image (file or str) – A file object with image data or a path to a file on filesystem.
  • timeout (float or tuple) – (optional) How long to wait for the server to send data before giving up, as a float, or a Python Requests timeout tuple.
search_images_by_id(image_id, timeout=None)[source]

Perform search over collection based on image within the same collection with ID image_id.

Parameters:
  • image_id – ID of an image previously added to the collection.
  • timeout (float or tuple) – (optional) How long to wait for the server to send data before giving up, as a float, or a Python Requests timeout tuple.

Python Requests Authentication class

class visualsnoop.auth.VisualSnoopHMACAuth(public_key, secret_key)[source]

Attaches VisualSnoop specific HTTP HMAC Authentication to the given Request object.

Parameters:
  • public_key – Public key generated for a collection on VisualSnoop Keys page.
  • secret_key – Secret key associated with the public key.

Exception class

exception visualsnoop.exceptions.VisualSnoopError[source]

A VisualSnoop error occurred.