Python 3 CLI Uploader for Zipline v3 and Django Files.
Zipline CLI is currently functional and Under Active Development.
Please open a Feature Request
for new features and submit an Issue
for any bugs you find.
- Zipline: https://zipline.diced.tech/
- Django Files: https://django-files.github.io/
Important
An update for Zipline v4 is currently in progress.
Zipline-CLI v1 "should" work with both Zipline v3 and v4.
# v4: Add url to line 104: ["url"]
return ZipURL(r.json()["files"][0]["url"])
python3 -m pip install zipline-cli
zipline --setup
From PyPi using pip:
python3 -m pip install zipline-cli
From GitHub using pip:
python3 -m pip install git+https://github.com/cssnr/zipline-cli.git
From Source using pip:
git clone https://github.com/cssnr/zipline-cli.git
python3 -m pip install -e zipline-cli
From Source using setuptools:
git clone https://github.com/cssnr/zipline-cli.git
cd zipline-cli
python3 setup.py install
To completely remove from any above install methods:
python3 -m pip uninstall zipline-cli
Setup Zipline URL and Token:
zipline --setup
Upload a File:
zipline test.txt
Upload Multiple Files:
zipline file1.txt file2.txt
Create Text File from Input
cat test.txt | zipline
Create Text File from Clipboard
zipline
# Paste or Type contents, followed by a newline, then Ctrl+D (Ctrl+Z on Windows)
Environment Variables are stored in the .zipline
file in your home directory.
- Location:
~/.zipline
or$HOME/.zipline
Variable | Description |
---|---|
ZIPLINE_URL | URL to your Zipline Instance |
ZIPLINE_TOKEN | Authorization Token from Zipline |
ZIPLINE_EMBED | Set this enable Embed on your uploads |
ZIPLINE_FORMAT | Output Format after upload. Variables: {filename} , {url} and {raw_url} |
ZIPLINE_EXPIRE | Zipline: https://zipline.diced.tech/docs/guides/upload-options#image-expiration |
ZIPLINE_EXPIRE | Django Files: https://github.com/onegreyonewhite/pytimeparse2#pytimeparse2-time-expression-parser |
See .zipline.example for an example .zipline
file.
You may override them by exporting the variables in your current environment
or using the corresponding command line arguments. Use zipline -h
for more info.
Initialize the class with your Zipline URL. Everything else is a header passed as a kwarg. The API does not yet support environment variables.
Zipline Token/Authorization is a header kwarg and can be passed as follows:
from zipline import Zipline
zipline = Zipline('ZIPLINE_URL', authorization='ZIPLINE_TOKEN')
Upload a File
from zipline import Zipline
zipline = Zipline('ZIPLINE_URL', authorization='ZIPLINE_TOKEN')
with open('text.txt') as f:
url = zipline.send_file('test.txt', f)
print(url)
For general help or to request a feature, see:
- Q&A Discussion: https://github.com/cssnr/zipline-cli/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/zipline-cli/discussions/categories/feature-requests
If you are experiencing an issue/bug or getting unexpected results, you can:
- Report an Issue: https://github.com/cssnr/zipline-cli/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: https://cssnr.github.io/feedback/