Installation¶
This part of the documentation covers the installation of PyUploadcare.
Pip¶
In order to install pyuploadcare, simply run:
$ pip install pyuploadcare
To use in Django project install with extra dependencies:
$ pip install pyuploadcare[django]
Get the Code¶
PyUploadcare is developed on GitHub. You can clone the public repository:
$ git clone git://github.com/uploadcare/pyuploadcare.git
After that you can install it:
$ pip install .
Update to version 2.0¶
Some caveats about migration process from version 1.x to 2.x.
A version 2.0 contains the next breaking changes:
Now, you should import Django models’ fields (e.g
ImageField) directly from thepyuploadcare.dj.modelsmodule.Changed initializing for the
FileListandGroupListclasses. Thesinceanduntilparameters have been removed. Use combination ofstarting_pointandorderinginstead.The
ucare listCLI command has been renamed toucare list_files. And, according to the previous change, thesinceanduntilparameters have been removed. Thestarting_pointand ordering parameters added.
These last two changes are necessary for working with version 0.5 of REST API. So that means you can’t use these classes correctly with versions prior 0.5 (but that should not be an issue :)
Also, note that Django configuration option UPLOADCARE['widget_variant']
now is deprecated and it will be removed in next major release. Use
UPLOADCARE['widget_build'] instead.
Update to version 3.0¶
Some caveats about migration process from version 2.x to 3.x.
A version 3.0 contains the next breaking changes:
Resource attributes can be accessed now as properies, not methods. In 2.x version use
file.is_stored(), in 3.x verisons usefile.is_stored.Uploadcareclient should be initialized to access API. Refer to the documentation to see examples of usingUploadcareclient:uploadcare = Uploadcare( public_key='<your public key>', secret_key='<your private key>', )
File,FileGroup,FileListandGroupListresources cannot be initialized directly.uploadcare.file,uploadcare.file_group,uploadcare.list_files,uploadcare.list_file_groupsclient methods should be used instead:file: File = uploadcare.file('a771f854-c2cb-408a-8c36-71af77811f3b') file_group: FileGroup = uploadcare.file_group('0513dda0-582f-447d-846f-096e5df9e2bb~2') file_groups: GroupList = uploadcare.list_file_groups() files: FileList = uploadcare.list_files(stored=True)
pyuploadcare.confpackage still can be used for configuration, but it is more preferable to pass configuration options toUploadcareclient on initialization.pyuploadcare.confprovides default values for the client.
Update to version 4.0¶
A version 4.0 uses REST API 0.7 and contains the next breaking changes:
For
File.info: * File information doesn’t returnimage_infoandvideo_infofields anymore, they were moved into fieldcontent_infothat includes mime-type, image (dimensions, format, etc), video information (duration, format, bitrate, etc), audio information, etc. * Removedrekognition_infoin favor ofappdata.For
file_listmethod ofFileList: * Removed the option of sorting the file list by file size.For
File: * Removed methodcopyin favor oflocal_copyandremote_copymethods. * Files to upload must be opened in a binary mode.
Update to version 5.0¶
In version 5.0, we introduce a new file uploader, which is now the default for Django projects. If you prefer to continue using the old jQuery-based widget, you can enable it by setting the use_legacy_widget option in your configuration:
UPLOADCARE = {
...,
"use_legacy_widget": True,
}
Additionally, please take note that some settings have been renamed in this update. For example, UPLOADCARE["widget_version"] has been changed to UPLOADCARE["legacy_widget"]["version"]. You can find the full list of these changes in the changelog for version 5.0.0.