Skip to content

theirix/ptpimg-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ptpimg_uploader

PyPI version Build Status

Upload image file or image URL to the ptpimg.me image hosting.

Features

  • Upload local image files
  • Rehost images from image services (e.g., from imgur)
  • Copy resulting URL to clipboard
  • BBCode formatting support
  • Command-line and programmatic usage

Installation

Using pip (recommended):

pip install ptpimg_uploader

Using setup.py:

python setup.py install

Manual Dependencies:

  • Required: requests package
    • Debian/Ubuntu: apt-get install python3-requests
    • Other systems: pip3 install requests
  • Optional: pyperclip package for clipboard support
    • Install via: pip3 install pyperclip

API Key Setup

  1. Login to https://ptpimg.me
  2. Open browser developer tools (View -> Developer -> View Source in Chrome)
  3. Find api_key in the page source
  4. Copy the hexadecimal string (format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

Set your API key using either:

Environment variable (recommended):

# Add to your ~/.bashrc or ~/.zshenv
export PTPIMG_API_KEY=your-api-key-here

Or use the command-line option: -k / --api-key

Usage

Get help:

ptpimg_uploader -h

Upload a local image:

ptpimg_uploader ~/seed/mytorrent/folder.jpg

Rehost from URL:

ptpimg_uploader https://i.imgur.com/eaT6j3X.jpg

Multiple uploads (mix-and-match files and URLs):

ptpimg_uploader ~/seed/mytorrent/folder.jpg https://i.imgur.com/eaT6j3X.jpg

Additional command-line options

  • --bbcode: URLs will be wrapped in BBCode [img] tags
ptpimg_uploader --bbcode ~/seed/mytorrent/folder.jpg
  • --clip: Place a resulting URL to clipboard (if pyperclip package is installed)
ptpimg_uploader --clip ~/seed/mytorrent/folder.jpg
  • --nobell: Disable completion sound. If output is a terminal, a bell will be ringed on completion.

Programmatic Usage

The package can be used as a library via the upload function for programmatic access.

License

BSD

Acknowledgments

  • mjpieters - a great refactoring and Python packaging
  • lukacoufyl - fixing image upload order

About

Upload images to ptpimg

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages