A command line interface for Cloudinary with full API support
Project description
Cloudinary CLI
Features
This command line interface is fully and seamlessly integrated with Cloudinary's APIs.
Requirements
Python 3.x
Setup
-
Set your CLOUDINARY_URL environment variable by adding
export CLOUDINARY_URL=<YOUR_CLOUDINARY_URL>to your terminal configuration file (using~/.bash_profileas an example here):echo "export CLOUDINARY_URL=YOUR_CLOUDINARY_URL" >> ~/.bash_profile && source ~/.bash_profile -
To install this package, run:
pip3 install cloudinary-cli -
Make sure your configuration is set up properly by running
cld whoami. It should print:cloud_name: <YOUR_CLOUD_NAME> api_key: <API_KEY>
Quickstart
Important commands
cld --help # lists available commands
cld search --help # Search API usage
cld admin --ls # Admin API functions
cld uploader --ls # Upload API functions
cld upload --help # Custom upload function
Using temporary Cloudinary configurations requires the -c option:
cld -c <CLOUDINARY_URL> <COMMAND> <OPTIONS> <PARAMS>
Upload API
Bindings for the Upload API.
The basic syntax using the Upload API is as follows:
Usage: cld uploader [OPTIONS] [PARAMS]...
Upload API bindings
format: cld uploader <function> <parameters> <optional_parameters>
eg. cld uploader upload http://res.cloudinary.com/demo/image/upload/sample public_id=flowers
OR
cld uploader upload http://res.cloudinary.com/demo/image/upload/sample -o public_id flowers
Options:
-o, --optional_param TEXT... Pass optional parameters as raw strings
-ls, --ls List all available functions in the Upload API
--help Show this message and exit.
Example: I want to change the asset with public_id:"flowers" from type:upload to type:private using the rename method, which takes two parameters - from_public_id and to_public_id.
The following two commands will do the same thing:
cld uploader rename flowers secret_flowers to_type=private
cld uploader rename flowers secret_flowers -o to_type private
Admin API
Bindings for the Admin API follows the same format as the Upload API:
Usage: cld admin [OPTIONS] [PARAMS]...
Admin API bindings
format: cld admin <function> <parameters> <optional_parameters>
eg. cld admin resources max_results=10 tags=sample
OR
cld admin resources -o max_results 10 -o tags sample
OR
cld admin resources max_results=10 -o tags sample
Options:
-o, --optional_param TEXT... Pass optional parameters as raw strings
-ls, --ls List all available functions in the Admin API
--help Show this message and exit.
Example: I want to create a transformation and get information about that transformation:
cld admin create_transformation my_new_transformation w_500,h_500,c_crop,e_vectorize
cld admin transformation my_new_transformation
Search API
Search API bindings allow you to enter in a Lucene query string as the expression.
Usage: cld search [OPTIONS] [QUERY]...
Search API bindings
Usage: cld search <Lucene query search string> <options>
(eg. cld search cat AND tags:kitten -s public_id desc -f context -f tags -n 10)
Options:
-f, --with_field TEXT Field to include in the result
-s, --sort_by TEXT... Sort search results by (field, <asc|desc>)
-a, --aggregate TEXT Aggregation to apply to the query
-n, --max_results INTEGER Maximum results to return. default: 10 max: 500
-c, --next_cursor TEXT Continue a search using an existing cursor
--help Show this message and exit.
Other basic commands
url- generates a Cloudinary URL for an assetconfig- current Cloudinary CLI configuration
Custom commands
upload_dir- Uploads a directory to Cloudinary and persists the folder structure.ls- Lists all resources based on resource search parameters in your cloud and returns specific fields (all if none is specified). Note - this uses multiple Admin API calls.make- Scaffolds a template. Currently limited to HTML templates for Upload Widget, Product Gallery, Video Player, and Media Library, and a few Python scripts.
Sample resources
Opens a demo account URL for a sample resource
Usage:
cld <sample_resource> <transformation>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cloudinary-cli-0.2.1.tar.gz.
File metadata
- Download URL: cloudinary-cli-0.2.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0e0c9b50272a5692949321753f75ce336bb7fae0d17b911c55b45db9d3682c9
|
|
| MD5 |
9a609c8e8822916fa99fa6bf95d43b26
|
|
| BLAKE2b-256 |
06e3a66b231f4435802985fbb3164faed3b260c2d224741980359bb285080d2a
|