Tender
A Gemini (the protocol) low-level client, implemented in Python.
PyPI - Documentation - Source code - Issue tracker - Changelog
Prerequisites
- Python >= 3.14
Installation
Use your favorite Python package manager to install gemini-tender. Example using Pipenv:
pipenv install gemini-tender
Usage
Setting up the SSL context
The Gemini protocol requires usage of TLS >= 1.2. The first thing you thus have to do is to set up an SSL context.
A bare-minimum, Gemini-compliant context can be created and used right away:
import tender
context = tender.create_default_ssl_context()
This method creates a preconfigured ssl.SSLContext instance. This context will not validate any certificate and will accept any certificate since most Gemini servers use self-signed certificates.
Using a client certificate
Create a default SSL context, and set your certificates using Python's load_cert_chain():
import tender
context = tender.create_default_ssl_context()
context.load_cert_chain('cert.pem', 'key.pem')
Note that you must of course use one context per identity.
Sending requests
As simple as (all examples assume you already have an asyncio context):
import tender
context = ...
try:
response = await tender.request('gemini://geminiprotocol.net/', context)
except ValueError:
# On invalid URL or malformed response
...
except OSError:
# All other errors
...
A tender.Response instance will be returned.
Custom timeout
There's a 5-second timeout by default for the whole request process. You can change that with the third timeout argument:
import tender
context = ...
try:
response = await tender.request('gemini://geminiprotocol.net/', context, timeout=10) # 10 seconds
except TimeoutError: # Note it's an OSError subclass
# Timeout reached
...
except ValueError:
# On invalid URL or malformed response
...
except OSError:
# All other errors
...
Inspecting the response
Several attributes and methods in tender.Response are available:
is_failure()determines whether the status is a permanent or temporary failureis_input(),is_success(),is_redirect(),is_tempfail(),is_permfail()andis_auth()determine the status groupstatusis the status as an integer- For input responses:
promptis the prompt as a string
- For success responses:
bodyis the raw response body as bytesmime_typeis atender.MimeTypeinstance (read below for more info)gemtextmay be atender.Gemtextinstance if the returned MIME type istext/gemini, orNoneinstead. Read below for more info
- For redirect responses:
urlis the redirect URL as a string
- For temporary failure, permanent failure and auth responses:
error_msgis the error message as a string orNoneif there is none
Inspecting the response's MIME type
tender.MimeType is a named tuple, with the following attributes:
media_type- a string containing the actual MIME type (e.g.text/gemini)parameters- a dictionary containing the associated parameters (e.g.{'charset': 'utf-8', 'lang': 'fr'})
Reading the parsed gemtext
tender.Gemtext exposes the following attributes:
lines- a list of parsed lines constituting the gemtext document. This list may contain instances of the following named tuples and associated attributes:tender.Text(text- string)tender.Link(url- string,label- string orNone)tender.Heading1(text- string)tender.Heading2(text- string)tender.Heading3(text- string)tender.ListItem(text- string)tender.Quote(text- string)tender.Preformatted(text- string,alt- string orNone)
lang- a list of language codes, parsed from the response's MIME type, orNoneif there's none
Development
Getting source code and installing the package
Requires pip >= 25.1 in a virtualenv.
- Clone the repository
- From the package's root:
pip install --editable . --group dev
Releasing the package
__version__insrc/tender/__init__.pymust be updated beforehand. It should adhere to Semantic Versioning- Create an associated Git tag (must exactly match the aforementioned version)
rm -rf dist/ && python -m buildtwine upload dist/*- An associated GitHub release must be created following the Keep a Changelog format
Metadata
Release files for gemini-tender 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gemini_tender-0.3.0.tar.gz | 7.4 kB | Without provenance | Details for gemini_tender-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gemini_tender-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for gemini_tender-0.3.0-py3-none-any.whl |
Total release size: 15.7 kB
Release files / gemini_tender-0.3.0.tar.gz
| Download URL | gemini_tender-0.3.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba1e512b60f06b5155eb17bfc9908914e4467d6b9813728650746645c3d6fcc1
|
|
BLAKE2b-256 checksum How to use checksums |
b22ed87b3341301cf6dc177a033b0948674f174a2e51de3a64aff7bc541707a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Release files / gemini_tender-0.3.0-py3-none-any.whl
| Download URL | gemini_tender-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1714bb6e114da7a6144329f543fe765ec716020cf00e99421e313002a07f7a8
|
|
BLAKE2b-256 checksum How to use checksums |
4129f4866e169a0530882c25303ceb01925e80cd606de735e64257f55e14487b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Security for gemini-tender 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.