Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Python library for Uploadcare.com

Project Description
=============================================
PyUploadcare: a Python library for Uploadcare
=============================================

.. image:: https://travis-ci.org/uploadcare/pyuploadcare.png?branch=master
:target: https://travis-ci.org/uploadcare/pyuploadcare
:alt: Build Status
.. image:: https://readthedocs.org/projects/pyuploadcare/badge/?version=latest
:target: https://readthedocs.org/projects/pyuploadcare/?badge=latest
:alt: Documentation Status
.. image:: https://coveralls.io/repos/github/uploadcare/pyuploadcare/badge.svg?branch=master
:target: https://coveralls.io/github/uploadcare/pyuploadcare?branch=master
:alt: Coverage
.. image:: https://landscape.io/github/uploadcare/pyuploadcare/master/landscape.svg?style=flat
:target: https://landscape.io/github/uploadcare/pyuploadcare/master
:alt: Code Health

Simple file uploads for the web are of most importance
for us at `Uploadcare`_. Today, everyone is used to the routine of
allowing users to upload their pics or attach resumes. The routine
covers it all: installing image processing libraries, adjusting permissions,
ensuring servers never go down, and enabling CDN.
Features like uploading from Facebook or manual crop are weighty,
hence rare.
Our goal is to change the status quo.

This library consists of the `Uploadcare`_ API interface and a couple
of Django goodies.

Simple as that, Uploadcare ``ImageField`` can be added to an
existing Django project in just a couple of `simple steps`_.
This will enable your users to see the upload progress, pick files
from Google Drive or Instagram, and edit a form while files are
being uploaded asynchronously.

.. code-block:: python

from django import forms
from django.db import models

from pyuploadcare.dj.models import ImageField
from pyuploadcare.dj.forms import FileWidget


class Candidate(models.Model):
photo = ImageField(blank=True, manual_crop="")


# optional. provide advanced widget options: https://uploadcare.com/documentation/widget/#configuration
class CandidateForm(forms.Form):
photo = ImageField(widget=FileWidget(attrs={
'data-cdn-base': 'https://cdn.super-candidates.com',
'data-image-shrink': '1024x1024',
}))

.. image:: https://ucarecdn.com/dbb4021e-b20e-40fa-907b-3da0a4f8ed70/-/resize/800/manual_crop.png

Features
--------

- Python wrapper for Uploadcare `REST`_ and `Upload`_ APIs.
- Django widget with useful manual crop and multi-upload.
- *ucare* console utility.
- hosted assets (Kudos to `Sławek Ehlert`_!).

Requirements
------------

``pyuploadcare`` requires Python 2.6, 2.7, 3.3, 3.4 or 3.5.

If you're using ``pyuploadcare`` with Django, check ``.travis.yml`` for supported
Python-Django combinations.


Installation
------------

In order to install ``pyuploadcare``, simply run:

.. code-block:: console

$ pip install pyuploadcare

or, if you prefer it the old way:

.. code-block:: console

$ easy_install pyuploadcare

Testing
-------

Besides the `Travis CI`_ we use tox. In order to run tests just:

.. code-block:: console

$ pip install tox
$ tox

Contributors
------------

- `@marselester`_
- `@dmitry-mukhin`_
- `@zerc`_
- `@homm`_
- `@va1en0k`_

.. _Uploadcare: https://uploadcare.com/
.. _simple steps: https://pyuploadcare.readthedocs.org/en/latest/quickstart.html
.. _Sławek Ehlert: https://github.com/slafs
.. _Travis CI: https://travis-ci.org/uploadcare/pyuploadcare
.. _REST: https://uploadcare.com/documentation/rest/
.. _Upload: https://uploadcare.com/documentation/upload/
.. _@marselester: https://github.com/marselester
.. _@dmitry-mukhin: https://github.com/dmitry-mukhin
.. _@zerc: https://github.com/zerc
.. _@homm: https://github.com/homm
.. _@va1en0k: https://github.com/va1en0k


.. :changelog:

History
-------

2.2.1
~~~~~

- Add file.create_local_copy and file.create_remote_copy methods.
- Add new ``make_public`` and ``pattern`` parameters to file.create_remote_copy method.
- Add new ``store`` parameter to file.create_local_copy methods.
- Update CDN link to the widget.
- Use wildcard ``2.x`` to always get the latest
patch or minor version of widget version ``2``. See `widget changelog`_.
- Update bundled widget to version ``2.10.3``. See `widget changelog`_.

2.1.0
~~~~~

- Support auto storing in upload requests
- Updated widget to version 2.10.0 (see `widget changelog`_).
- Drop support for Python 3.2
- Simplify and reduce test matrix in ``.travis.yml``

2.0.1
~~~~~

- Fixed issue with missing ``ucare_cli`` package.

2.0
~~~

- Added support for version 0.5 of REST API.
- Updated widget to version 2.8.1 (see `widget changelog`_).
- Added the ``ucare list_groups`` command.
- Removed deprecated entities.

**NB**: There are backward incompatible changes. For detailed information about the upgrade process see `update to version 2.0`_.

1.3.6
~~~~~

- Fixed ZeroDivision error when trying to sync files with no size

1.3.5
~~~~~

- Added support of Django 1.9
- Removed indication of Unicode strings from output of `ucare`
- Fixed a group representation for `ucare create_group` command
- Fixed error with `ucare sync` when trying to processing of not image files

1.3.4
~~~~~

- Added storage operations
- Added request_limit to ucare_cli

1.3.3
~~~~~

- Expanded User-Agent

1.3.2
~~~~~

- Added sync command to ucare_cli
- Autogenerated documentation for ucare_cli
- update widget to 2.5.5 (see `widget changelog`_)

1.3.1
~~~~~

- Default CDN base to https://ucarecdn.com
- Allow changing CDN base via Django settings
- update widget to 2.5.0 (see `widget changelog`_)

1.3.0
~~~~~

- API version was updated up to *0.4*.
- update widget to 2.4.0 (see `widget changelog`_)

1.2.15
~~~~~~

- update widget to 2.3.1 (see `widget changelog`_)


1.2.14
~~~~~~

- update widget to 1.5.5 (see `widget changelog`_)


1.2.13
~~~~~~

- improve synchronous upload API
- fix encoding issues with pip3
- update widget to 1.5.4 (see `widget changelog`_)
- add AUTHORS.txt


1.2.12
~~~~~~

- add synchronous upload from URL method to `File`
- UploadcareExceptions are `__repr__`'ed properly
- update widget to 1.5.3 (see `widget changelog`_)


1.2.11
~~~~~~

- fix "source" composition for copy requests
- let configure default throttle retry count via `conf.retry_throttled`


1.2.10
~~~~~~

- handle responses for HEAD and OPTION requests
- update widget to 1.4.6


1.2.9
~~~~~

- compatibility with Django 1.7


1.2.8
~~~~~

- update widget to 1.4.0


1.2.7
~~~~~

- handle rest api throttling


1.2.6
~~~~~

- update widget to 1.2.3
- fixed compatibility with six library version 1.7.0 and above


1.2.5
~~~~~

- fixed setup script


1.2.4
~~~~~

- update widget to 1.0.1
- fixed logging when response contains unicode chars


1.2.3
~~~~~

- update widget to 0.17.1


1.2.2
~~~~~

- add File.copy()
- add data attribute to UploadcareException
- update widget to 0.13.2
- update pyuploadcare.dj.models.ImageField crop validation


1.2.1
~~~~~

``https://ucarecdn.com/`` URL was returned to serve widget's assets.


1.2
~~~

- CDN URL has been changed to ``http://www.ucarecdn.com/``. Previous URL
``https://ucarecdn.com/`` is depricated.
- Widget was updated up to *0.10.1*.

1.1
~~~

- Widget was updated up to *0.10*.
- Default API version was updated up to *0.3*.
- Django settings were merged into UPLOADCARE dictionary.
- Performance was improved by reusing requests' session.

1.0.2
~~~~~

``UnicodeDecodeError`` was fixed. This bug appears when
`request <https://pypi.python.org/pypi/requests/>`_'s ``method``
param is unicode and ``requests.request()`` got ``files`` argument, e.g.:

.. code-block:: python

>>> requests.request(u'post', u'http://httpbin.org/post',
... files={u'file': open('README.rst', 'rb')})
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 ...

1.0.1
~~~~~

- Widget was updated up to *0.8.1.2*.
- It was invoking ``File.store()``, ``FileGroup.store()`` methods on every
model instance saving, e.g.:

.. code-block:: python

photo.title = 'new title'
photo.save()

Now it happens while saving by form, namely by calling
``your_model_form.is_valid()``. There is other thing that can trigger
storing -- calling ``photo.full_clean()`` directly.

1.0
~~~

- Python 3.2, 3.3 support were added.
- File Group creating was added.
- Methods per API field for File, FileGroup were added.
- Deprecated things were deleted. This version is not backward compatible.
For detailed information see
https://pyuploadcare.readthedocs.org/en/v0.19/deprecated.html

0.19
~~~~

- Multiupload support was added.
- ``argparse`` was added into ``setup.py`` requirements.
- Documentation was added and published on https://pyuploadcare.readthedocs.org

0.18
~~~~

- Widget was updated up to *0.6.9.1*.

0.17
~~~~

- ``ImageField`` was added. It provides uploading only image files. Moreover,
you can activate manual crop, e.g. ``ImageField(manual_crop='2:3')``.
- More appropriate exceptions were added.
- Tests were separated from library and were restructured.
- Widget was updated up to *0.6.7*.
- Issue of ``FileField``'s ``blank``, ``null`` attributes was fixed.

0.14
~~~~

- Replace accept header for old api version

0.13
~~~~

- Fix unicode issue on field render

0.12
~~~~

- Add new widget to pyuploadcare.dj
- Remove old widget
- Use https for all requests

0.11
~~~~

- Add cdn_base to Ucare.__init__
- Get rid of api v.0.1 support
- Add File.ensure_on_s3 and File.ensure_on_cdn helpers
- Add File properties is_on_s3, is_removed, is_stored
- Fix url construction
- Add and correct waiting to upload and upload_from_url

0.10
~~~~

- Add console log handler to ucare
- Add wait argument to ucare store and delete commands
- Fix ucare arg handling

0.9
~~~

- Add bunch of arguments to ucare upload and upload_via_url commands
- Fix UploadedFile.wait()

0.8
~~~

- Fix file storing for old API
- Replaced Authentication header with Authorization
- Log warnings found in HTTP headers
- Replace old resizer with new CDN
- Add verify_api_ssl, verify_upload_ssl options
- Add custom HTTP headers to API and upload API requests

0.7
~~~

- Added __version__
- Added 'User-Agent' request header
- Added 'Accept' request header
- Added ucare config file parsing
- Added pyuploadcare/tests.py
- Replaced upload API
- Replaced File.keep with File.store, File.keep is deprecated
- File.store uses new PUT request
- Added timeouts to File.store, File.delete
- Added upload and upload_from_url to ucare
- Added tests during setup
- Replaced httplib with requests, support https (certificates for api requests are verified)
- Added api_version arg to UploadCare, default is 0.2

0.6
~~~

- Added ucare cli utility
- Added PYUPLOADCARE_UPLOAD_BASE_URL setting
- Added PYUPLOADCARE_WIDGET_URL
- Updated widget assets to version 0.0.1
- Made properties out of following pyuploadcare.file.File's methods:

- api_uri()
- url()
- filename()
- Changed pyuploadcare.UploadCareException.__init__


.. _widget changelog: https://github.com/uploadcare/uploadcare-widget/blob/master/HISTORY.markdown
.. _update to version 2.0: http://pyuploadcare.readthedocs.org/en/v2.0/install.html#update-to-version-2-0
Release History

Release History

This version
History Node

2.2.1

History Node

2.1.0

History Node

2.0.1

History Node

2.0

History Node

1.3.6

History Node

1.3.5

History Node

1.3.4

History Node

1.3.3

History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2.15

History Node

1.2.14

History Node

1.2.13

History Node

1.2.12

History Node

1.2.11

History Node

1.2.10

History Node

1.2.9

History Node

1.2.8

History Node

1.2.7

History Node

1.2.6

History Node

1.2.5

History Node

1.2.4

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

1.2

History Node

1.1

History Node

1.0.2

History Node

1.0.1

History Node

1.0

History Node

0.19

History Node

0.18

History Node

0.17

History Node

0.16

History Node

0.14

History Node

0.13

History Node

0.12

History Node

0.11

History Node

0.10

History Node

0.9

History Node

0.8

History Node

0.7

History Node

0.6

History Node

0.5

History Node

0.4

History Node

0.3

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyuploadcare-2.2.1.tar.gz (195.0 kB) Copy SHA256 Checksum SHA256 Source Apr 7, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting