Skip to main content

bubblegum

Build Status Pypi Pyversions

bubblegum is a script to make and manage uploads to image hosts. Several image hosts are supported, to which one can directly upload images or rehost images by URL.

Usage

Basic image uploading can be done via the bubblegum upload command. To upload a local image file, run bubblegum upload /path/to/image.png. To rehost a URL, run bubblegum upload https://this.url.serves.an/image.png.

The default image host is https://vgy.me, as it does not require client authorization. The image host that will be used can be changed with the --host flag in the upload command, e.g. bubblegum upload --host=imgur.com /path/to/image.png. The default image host can also be changed in the config file. Host options can be viewed with the bubblegum upload --help command.

Uploading/rehosting multiple images simultaneously is also supported, via multiple arguments to the upload command. bubblegum upload a.jpg b.png will upload both images simultaneously. By default, 4 workers are spawned for image uploading. The number of workers can be increased or decreased in the config.

A history of uploaded images can be viewed with bubblegum history. The outputted list can be manipulated with the --sort, --limit and --offset options.

Config

The configuration can be edited with the bubblegum config command. A default configuration file is created when the script first runs.

Image Host Profiles

bubblegum includes loaded profiles for the following two hosts by default:

Other image host profiles can be found in the extra_profiles/ directory.

Image host profiles can be created/added to the application by adding a profile dictionary to the list of profiles in your config file. Each profile must contain 8 key/value pairs:

  • image_host_name - The name of the image host, for use with the --host= option.
  • image_host_url - The URL of the host's image uploading endpoint.
  • request_headers - Extra headers to include in the upload request.
  • upload_form_file_argument - The name of the key for the image file in the form.
  • upload_form_data_argument - A dictionary sent as the form data in a file upload.
  • rehost_form_url_argument - If the host supports URL rehosting, the name of the key for the URL in the form. Otherwise, set it to null.
  • rehost_form_data_argument - A dictionary sent as the form data in a URL rehost.
  • json_response - A boolean indicating whether or not the returned data is JSON or not. If True, the data response variable will be the deserialized JSON. If False, the data request response variable will be the response text.
  • image_url_template - A string of an f-string (yeah, sounds confusing) for the image URL. Can access the request response via the data variable.
  • deletion_url_template - A string of an f-string for the deletion URL. Can access the request response via the data variable.

Imgur

To upload to imgur, a Client ID must be created and supplied. Details on creating a Client ID can be found at https://apidocs.imgur.com/#authorization-and-oauth. Once created, the Client ID can be added to the config, as the imgur_client_id.

Metadata

Release files for bubblegum 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bubblegum 1.0.1
File Size Uploaded
bubblegum-1.0.1.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bubblegum 1.0.1
File Interpreter ABI Platform
bubblegum-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.0 kB

Release files / bubblegum-1.0.1.tar.gz

Download URL bubblegum-1.0.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
874254677cdab3ce4ce0799bc62f5c0c2316a197c9a04e0e6f8e56a042e5f5c0
BLAKE2b-256 checksum
How to use checksums
ed022ee74fba4eaa9549fa5f2123be931141c3eea44ce481c4f7e830cad1d0a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.6 Linux/5.9.10-1-default

Release files / bubblegum-1.0.1-py3-none-any.whl

Download URL bubblegum-1.0.1-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52776319a63052e16b657a0021b28b7df79a07f8a469efb78c13036ec578c953
BLAKE2b-256 checksum
How to use checksums
b17c740050a4e16f86214edd899e50a2d5e261d84d98ae6c28c4aaa982a835e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.6 Linux/5.9.10-1-default

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page