Python API Client

Python integration handles uploads and file operations by wrapping Uploadcare Upload API and REST API. This comprehensive API client lets you use most of the Uploadcare features from within your Python app.

GitHub

Features

Upload features:

  • Upload files from local storage and URLs (up to 5 TB)
  • Multipart uploading for large files
  • Uploading network to speed uploading jobs (like CDN)

File management features:

  • Get file info and perform various operations (store/delete/copy) with them
  • Work with groups of files
  • Get info about account project
  • Manage webhooks
  • Convert documents
  • Encode and transform videos

Security features:

  • Secure authentication
  • Secure uploads (signed uploads)
  • Secure delivery (signed URLs)
  • Secure webhooks (signing secret)

Requirements

  • Python 3.6, 3.7, 3.8, 3.9.

To use pyuploadcare with Python 2.7 please install pyuploadcare < 3.0.

If you're using pyuploadcare with Django, check tox.ini or .github/workflows for supported Python-Django combinations.

Install

In order to install pyuploadcare, run these commands in CLI:

pip install pyuploadcarebash

or, if you prefer it the old way:

easy_install pyuploadcarebash

To use in Django project install with extra dependencies:

$ pip install pyuploadcare[django]

Usage example

Here is an example how to include Uploadcare ImageField into an existing Django project.

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/docs/uploads/widget/config/#options
class CandidateForm(forms.Form):
    photo = ImageField(widget=FileWidget(attrs={
        'data-cdn-base': 'https://cdn.super-candidates.com',
        'data-image-shrink': '1024x1024',
    }))python

Testing

In order to run tests:

pip install tox
tox

Example Django project

Check out example Django project. It features:

  • Project section
  • Files section
  • File Groups section
  • Files uploading
  • Documents conversion
  • Video conversion
  • Webhooks
  • Posts section