weboob.tools.capabilities.paste

class weboob.tools.capabilities.paste.BasePasteModule

Bases: weboob.capabilities.paste.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)

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

weboob.tools.capabilities.paste.bin_to_b64(b)
weboob.tools.capabilities.paste.image_mime(data_base64, supported_formats=('gif', 'jpeg', 'png'))

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
weboob.tools.capabilities.paste.test()