woob.capabilities.image

class BaseImage(id='', url=NotLoaded, backend=None)[source]

Bases: _BaseImage

Represents an image file.

Variables:
  • url – (str) url

  • title – (str) File title

  • ext – (str) File extension

  • mime_type – (str) MIME Type

  • author – (str) File author

  • description – (str) File description

  • date – (date, datetime) File publication date

  • last_update – (date, datetime) Last update or last modified date (default: Not available)

  • size – (int) File size in bytes (default: Not available)

  • rating – (int, float) Rating (default: Not available)

  • rating_max – (int, float) Maximum rating (default: Not available)

  • license – (str) License name

  • nsfw – (bool) Is this Not Safe For Work (default: False)

  • thumbnail – (Thumbnail) Thumbnail of the image

  • data – (bytes) Data of image

to_dict()[source]
class Thumbnail(url='')[source]

Bases: _BaseImage

Thumbnail of an image.

Variables:
  • url – (str) url

  • title – (str) File title

  • ext – (str) File extension

  • mime_type – (str) MIME Type

  • author – (str) File author

  • description – (str) File description

  • date – (date, datetime) File publication date

  • last_update – (date, datetime) Last update or last modified date (default: Not available)

  • size – (int) File size in bytes (default: Not available)

  • rating – (int, float) Rating (default: Not available)

  • rating_max – (int, float) Maximum rating (default: Not available)

  • license – (str) License name

  • data – (bytes) Data

class CapImage[source]

Bases: CapFile

Image file provider

search_image(pattern, sortby=CapFile.SEARCH_RELEVANCE, nsfw=False)[source]

search for an image file

Parameters:
  • pattern (str) – pattern to search on

  • sortby – sort by …(use SEARCH_* constants) (default: CapFile.SEARCH_RELEVANCE)

  • nsfw (bool) – include non-suitable for work images if True (default: False)

Return type:

iter[BaseImage]

get_image(_id)[source]

Get an image file from an ID.

Parameters:

id (str) – image file ID

Return type:

BaseImage]