Install & Compatibility
Where this runs
tested against v1.0.9.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.789s · 40.9MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 4.2s · import 0.732s · 41MB
39MB installed
● package 39MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SendSafely
✓ from sendsafely import SendSafely, Package
The primary classes for interacting with the SendSafely API are 'SendSafely' for authentication and general API handling, and 'Package' for managing secure packages.
Package
✓ from sendsafely import SendSafely, Package
✗ package = sendsafely.Package()
The 'Package' object should be instantiated by passing a 'SendSafely' instance to its constructor, not directly or without arguments.
This quickstart demonstrates how to initialize the SendSafely client, create a new secure package, add an encrypted message, specify a recipient, and finalize the package to obtain a secure download link. Ensure your `BASE_URL`, `API_KEY`, and `API_SECRET` are obtained from your SendSafely profile.
import os
from sendsafely import SendSafely, Package
# Retrieve credentials from environment variables for security
BASE_URL = os.environ.get('SENDSAFELY_BASE_URL', 'https://your-company.sendsafely.com')
API_KEY = os.environ.get('SENDSAFELY_API_KEY', 'YOUR_API_KEY')
API_SECRET = os.environ.get('SENDSAFELY_API_SECRET', 'YOUR_API_SECRET')
RECIPIENT_EMAIL = os.environ.get('SENDSAFELY_RECIPIENT_EMAIL', 'user@example.com')
if not all([BASE_URL, API_KEY, API_SECRET, RECIPIENT_EMAIL]):
print("Please set SENDSAFELY_BASE_URL, SENDSAFELY_API_KEY, SENDSAFELY_API_SECRET, and SENDSAFELY_RECIPIENT_EMAIL environment variables.")
exit(1)
try:
# Create a SendSafely instance object for authentication
sendsafely_client = SendSafely(BASE_URL, API_KEY, API_SECRET)
# Create a new package
package = Package(sendsafely_client)
# Add a secure message to the package
package.encrypt_and_upload_message("Hello this is a secure message from Python.")
# Add a recipient to the package
package.add_recipient(RECIPIENT_EMAIL)
# Finalize the package to generate the secure link
response = package.finalize()
if response and response.get('secureLink'):
print(f"Secure Package Link: {response['secureLink']}")
else:
print("Failed to finalize package or retrieve secure link.")
print(response)
except Exception as e:
print(f"An error occurred: {e}")
Debug
Known issues
breakingThe `sendsafely` library (specifically its `pgpy` dependency) encountered a `ModuleNotFoundError: No module named 'imghdr'` when run on Python 3.13 due to the removal of `imghdr` from the standard library.fixEnsure you are using the latest version of the `sendsafely` library (1.0.9.6 or newer) which includes a patch to resolve this Python 3.13 compatibility issue.
affects: Potentially all versions before a patch for Python 3.13. The issue was reported and subsequently fixed.
gotchaFull access to all SendSafely API features, especially those for enterprise search and advanced workflows (e.g., SendSafely Actions), may require a SendSafely Enterprise subscription. Functionality can be limited for other account types.fixVerify your SendSafely subscription level if encountering unexpected API limitations or feature unavailability. Contact SendSafely support for enterprise access.
affects: All versions
gotchaDirectly interacting with the SendSafely REST API requires manual implementation of complex cryptographic operations (e.g., PGP encryption, key generation, timestamp and signature formatting). The Python Client API handles these complexities automatically.fixAlways prefer using the `sendsafely` Python Client API for secure file transfers and package management unless you have a specific need and expertise to implement the underlying cryptographic protocols correctly via the raw REST API.
affects: All versions
gotchaAPI Keys and API Secrets for authentication must be generated from the 'API Keys' section of your profile page when logged into your SendSafely portal. These credentials are distinct from user login credentials and are essential for programmatic access.fixGenerate dedicated API Keys and Secrets from your SendSafely account's profile settings. Do not attempt to use regular username/password for API authentication.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'imghdr'
The `imghdr` module, previously used by the `pgpy` dependency, was removed from the Python standard library in Python 3.13.
fixUpgrade the `sendsafely` library to version 1.0.9.6 or later, which contains a fix for Python 3.13 compatibility.
sendsafely.exceptions.APIError: {'errorCode': 401, 'message': 'Unauthorized'}
This usually indicates incorrect or missing `API_KEY`, `API_SECRET`, or an invalid `BASE_URL` during client initialization. It can also occur if the API key lacks necessary permissions or if a recipient is not authorized for a package.
fixDouble-check your `BASE_URL`, `API_KEY`, and `API_SECRET` values. Ensure they are correct and have the necessary permissions for the operations you are performing. Verify the recipient email if applicable. Generate new credentials if unsure.
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
This error often points to network connectivity issues, an incorrect `BASE_URL`, or problems with the SendSafely server being unreachable or refusing the connection.
fixVerify your internet connection and that the `BASE_URL` is correct and accessible. Ensure no firewalls or proxies are blocking the connection. If the URL is correct, the SendSafely service might be temporarily unavailable. Consider adding retry logic with exponential backoff for transient network issues.
package = sendsafely.Package(sendsafely_client) Argument missing: 'sendsafely_instance'
The `Package` class constructor requires an instance of the `SendSafely` client to be passed as its first argument (`sendsafely_instance`).
fixInstantiate `Package` by providing an initialized `SendSafely` object: `package = Package(sendsafely_client)`.
Upgrade
Version history
1.0.10latest on PyPI · released May 19, 2026
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the SendSafely REST API.
pgpy==0.5.2requiredCrucial for handling OpenPGP encryption and decryption operations within the client. A specific version is pinned for compatibility.
cryptography==3.4.7requiredProvides cryptographic primitives used in secure operations. A specific version is pinned for compatibility.
six==1.15.0requiredPython 2 and 3 compatibility utilities.
idna==2.10requiredInternationalized Domain Names in Applications (IDNA) support.
certifi==2021.5.30requiredProvides Mozilla's carefully curated collection of Root Certificates for validating the trustworthiness of SSL certificates.
chardet==4.0.0requiredUniversal character encoding detector.
urllib3==1.26.5requiredHTTP client library, often a dependency of `requests`.
rsa==4.7.2requiredPython RSA implementation.
pyasn1==0.4.8requiredASN.1 types and codecs.