Skip to content

Python Module

ShareX CLI

Python projects can import the module directly.

The config object must be a dictionary loaded from the ShareX .sxcu JSON.

The get_config method loads this from a file or environment variable, or returns None.

from pathlib import Path
from sharex import api

config = api.get_config(Path("path/to/config.file"), 'SHAREX_CONFIG')  # (1)!
with open("filename", "rb") as f:
    url = api.upload_file(config, "filename", f)
print(f"{url=}")
  1. ShareX Custom Uploader Config JSON.

Or import the modules individually.

from sharex import get_config, upload_file

For more details see the api.py source code.

This API is incomplete and may change in the future.

The API exist to support the CLI and will adapt to fit those needs.

 

Question

If you need help getting started or run into any issues, support is available!