Skip to main content

No project description provided

Project description

ckanext-files

Upload and use standalone files. No resources, no datasets, just files.

Requirements

Compatibility with core CKAN versions:

CKAN version Compatible?
2.9 yes
master yes

Installation

To install ckanext-files:

  1. Install the extension

     pip install ckanext-files
    
  2. Add files to the ckan.plugins setting in your CKAN config file.

  3. Updgrade DB

     ckan db upgrade -p files
    

API

Each API action has corresponding auth-function with the same name. By default only sysadmin can pass auth check(unless different behavior explicitly mentioned in action description). Whenever you are using this extension feel free to redefine these auth-functions using tk.chained_auth_function.

Some of API actions has kind parameter. It defines which folder will store the file, which config options will be applied, etc. Default value is ckanext_files_file

  • files_file_create

    Create new file entity.

    Parameters:

    • name Name for the uploaded file.
    • upload File itself
    • kind Type of uploaded file.
    • extras Dictionary with any details that can be used for your needs.

    Returns:

    • id: str Unique ID of the new file.
    • name: str Name for the file.
    • url: str File itself
    • kind: str Type of uploaded file.
    • uploaded_at: datetime.datetime File creation date
    • extras: Optional[dict[str, Any]] Dictionary with any details that can be used for your needs.
  • files_file_show

    Show file detiles.

    Parameters:

    • id: str: ID or name of file entity

    Returns: same as files_file_create

  • files_file_update

    Update file entity.

    Parameters:

    • id: str
    • name: Optional[str] Name for the file file.
    • upload: Optional[werkzeug.datastructures.FileStorage] File itself
    • kind: Optional[str] Type of uploaded file.
    • extras: Optional[dict[str, Any]] Dictionary with any details that can be used for your needs.

    Returns: same as files_file_create

  • files_file_delete

    Remove file entity.

    Parameters:

    • id: str: ID of file entity

    Returns: True

Config settings

# Allowed size for uploaded file in MB.
# (optional, default: 2).
ckanext.files.<KIND>.max_size = 2

Project details


Download files

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

Source Distribution

ckanext-files-0.0.3.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

ckanext_files-0.0.3-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file ckanext-files-0.0.3.tar.gz.

File metadata

  • Download URL: ckanext-files-0.0.3.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for ckanext-files-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a11c648239a576f7ebc89c709cfc8fcdf5b2763664915448daa6858d1f82c4ff
MD5 3ce92f3c8390571dc13baaa11e01acd1
BLAKE2b-256 8a4bf3d040832c2f609619fe4e7853d3a7802393f04c0cac36e48118c17c2f2f

See more details on using hashes here.

File details

Details for the file ckanext_files-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ckanext_files-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for ckanext_files-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ca4ce1bca44c2e0675752a26db7fc4693f64967787646954df4c9a1b43a283b9
MD5 2be48f0ca0dad72bc965ca7cf504a3ae
BLAKE2b-256 9b09afeb2069c43c75701aa675ff8dbe71322bb0766386bcd0db2b52e6d8bcb5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page