API documentation¶
Small picflash upload library
Picuplib basicly provides to different interfaces a function based and a class based. The class based just wrapps the function based but stores the apikey and default settings for the resize, rotation and noexif attribiutes.
-
picuplib.
upload
(apikey, picture, resize=None, rotation=u'00', noexif=False, callback=None)¶ prepares post for regular upload
Parameters: - apikey (str) – Apikey needed for Autentication on picflash.
- picture (str/tuple/list) – Path to picture as str or picture data. If data a tuple or list with the file name as str and data as byte object in that order.
- resize (str) – Aresolution in the folowing format: ‘80x80’(optional)
- rotation (str|degree) – The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
- noexif (boolean) – set to True when exif data should be purged. (optional)
- callback (function) – function witch will be called after every read. Need to take one argument. you can use the len function to determine the body length and call bytes_read().
-
picuplib.
remote_upload
(apikey, picture_url, resize=None, rotation=u'00', noexif=False)¶ prepares post for remote upload
Parameters: - apikey (str) – Apikey needed for Autentication on picflash.
- picture_url (str) – URL to picture allowd Protocols are: ftp, http, https
- resize (str) – Aresolution in the folowing format: ‘80x80’(optional)
- rotation (str|degree) – The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
- noexif (boolean) – set to True when exif data should be purged. (optional)
-
class
picuplib.
Upload
(apikey, resize=None, rotation=u'00', noexif=False, callback=None)¶ Class based wrapper for uploading. It stores the apikey and default settings for resize, rotation and the noexif parameter.
Parameters: - apikey (str) – Apikey needed for Autentication on picflash.
- resize (str) – Aresolution in the folowing format: ‘80x80’(optional)
- rotation (str|degree) – The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
- noexif (boolean) – set to True when exif data should be purged. (optional)
- callback (function) – function witch will be called after every read. Need to take one argument. you can use the len function to determine the body length and call bytes_read(). Only for local Upload!
Variables: - resize (str) –
- rotation (str) –
- noexif (boolean) – If true exif data will be deleted
- callback (function) –
-
Upload.
upload
(picture, resize=None, rotation=None, noexif=None, callback=None)¶ wraps upload function
Parameters: - picture (str/tuple/list) – Path to picture as str or picture data. If data a tuple or list with the file name as str and data as byte object in that order.
- resize (str) – Aresolution in the folowing format: ‘80x80’(optional)
- rotation (str|degree) – The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
- noexif (boolean) – set to True when exif data should be purged. (optional)
- callback (function) – function will be called after every read. Need to take one argument. you can use the len function to determine the body length and call bytes_read().
-
Upload.
remote_upload
(picture_url, resize=None, rotation=None, noexif=None)¶ wraps remote_upload funktion
Parameters: - picture_url (str) – URL to picture allowd Protocols are: ftp, http, https
- resize (str) – Aresolution in the folowing format: ‘80x80’(optional)
- rotation (str|degree) – The picture will be rotated by this Value. Allowed values are 00, 90, 180, 270.(optional)
- noexif (boolean) – set to True when exif data should be purged. (optional)