Python API Client

Uploadcare Python & Django integrations handle uploads and further operations with files by wrapping Upload and REST APIs.

GitHub →

Features

Uploading (Upload API):

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

File management (REST API):

  • Get file info
  • Perform various file operations (store/delete/copy/group)
  • Detect unsafe and malicious content
  • Encode and transform videos
  • Convert documents and other files
  • Recognize objects in the image
  • Add arbitrary file metadata
  • Manage webhooks

Image processing (URL API):

  • Compression
  • Geometry
  • Colors
  • Definition
  • Image and text overlays
  • Rotations
  • Recognition
  • File info
  • Proxy (fetch)

Security features:

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

Installation

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

pip install pyuploadcare

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, ImageField as ImageFormField

class Candidate(models.Model):
    photo = ImageField(blank=True, manual_crop='4:3')

# optional. provide advanced widget options:
# https://uploadcare.com/docs/file-uploader/configuration/
# https://uploadcare.com/docs/file-uploader/options/
class CandidateForm(forms.Form):
    photo = ImageField(widget=FileWidget(attrs={
        'source-list': 'local,url,camera',
        'camera-mirror': True,
    }))

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

Requirements

  • Python 3.8, 3.9, 3.10, 3.11, 3.12

To use pyuploadcare with Python 3.6 or 3.7 please install pyuploadcare < 5.0.

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

Django compatibility:

Py/Dj2.23.03.13.24.04.14.25.0
3.8XXXXXXX
3.9XXXXXXX
3.10XXXXX
3.11XXX
3.12XX