woob.tools.capabilities.paste

class BasePasteModule[source]

Bases: CapPaste

EXPIRATIONS = {}

List of expirations and their corresponding remote codes (any type can be used). The expirations, i.e. the keys, are integers representing the duration in seconds. There also can be one False key, for the “forever” expiration.

get_closest_expiration(max_age)[source]

Get the expiration closest (and less or equal to) max_age (int, in seconds). max_age set to False means we want it to never expire.

@return int or False if found, else None

image_mime(data_base64, supported_formats=('gif', 'jpeg', 'png'))[source]

Return the MIME type of an image or None.

Parameters:
  • data_base64 (str) – data to detect, base64 encoded

  • supported_formats – restrict list of formats to test (default: ('gif', 'jpeg', 'png'))

bin_to_b64(b)[source]