Python library for uploadcare
Python
Latest commit 4616bb6 Dec 2, 2016 @dayton1987 dayton1987 committed on GitHub Merge pull request #118 from uploadcare/upd_pyucr
Updated readme.rst for 'pyuploadcare'

README.rst

PyUploadcare: a Python library for Uploadcare

https://travis-ci.org/uploadcare/pyuploadcare.png?branch=master Documentation Status

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.

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',
    }))
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:

$ pip install pyuploadcare

or, if you prefer it the old way:

$ easy_install pyuploadcare

Testing

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

$ pip install tox
$ tox

Contributors

Current maintainer — @dmitry-mukhin.