Skip to main content

ignition - Gemini Protocol Client Transport Library

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Ignition: Python3 Gemini Protocol Client Transport Library

This is Gemini Control.  We're at T-1 minute, T-60 seconds and counting.  T-45 seconds and counting.  The range holding a final status check.  T-30 seconds.  Recorders have gone to fast speed.  Twenty seconds.  Fifteen seconds.  Ten, nine, eight, seven, six, five, four, three, two, one zero.  Ignition.

Ignition is a simple but powerful transport library for Python3 clients using the recently designed Gemini protocol. This project intends to implement all of the transport specifications (sections 1-4) of the Gemini protocol and provide an easy-to-use interface, so as to act as a building block in a larger application.

If you're building a Python3 application that uses Gemini, Ignition is your gateway to the stars, in very much the same way that requests is for HTTP and gopherlib is for Gopher.

In order to provide a best-in-class interface, this library does not implement the other parts of a typical client (including user interface and/or command line interface), and instead focuses on providing a robust programmatic API interface. This project also assumes that different user interfaces will have different requirements for their display of text/gemini files (.gmi), and/or other mime-types, and as such considers this portion of the specification beyond the scope of this project.

In addition, in order to provide stability and simplicity, minimal third-party dependencies are required for Ignition.

Project Status

GitHub release (latest by date) CI v2

The status is good to go.  This is Gemini Control.

Ignition is currently in prerelease. You can use Ignition today at your own risk, please monitor this repository for changes until version 1.0 is released. Please be advised that there may be breaking changes in the API until that time.

You can see ignition in action at gemini.cbrews.xyz.

Installation

⚠ Ignition currently supports Python versions 3.7 - 3.10.

Ignition can be installed via PIP. You should install it in alignment with your current development process; if you do not have a build process yet, I recommend you install within a virtual environment

pip install ignition-gemini

If you prefer to install from source, you can clone and install the repository:

git clone https://github.com/cbrews/ignition.git
cd ignition
python3 setup.py install

Simple Usage

The most basic usage of Ignition allows the user to create a request and get a response back from a remote Gemini capsule:

import ignition

# Fetch capsule content
response = ignition.request('//gemini.circumlunar.space')

# Get status from remote capsule
print(response.status)

# Get response information from remote capsule
print(response.data())

source

In all cases, Ignition assumes that the specified endpoint and protocol will respond over the Gemini protocol, so even if you provide a different protocol or port, it will assume that the endpoint is a Gemini capsule.

Key Features

This is Gemini Control.  The conversation between pilot and ground so far in this filght has largely been confined to the normal type of test pilot talk that you would expect.

✅ Ignition currently supports the following features:

  • Basic request/response connectivity to a Gemini-enabled server.
  • Basic URL parsing mechanics to allow for specifying protocol, host, port, path, and query params, as per RFC-3986
  • Optional referer URL handling. Ignition allows the user to pass a path & referer URL and can construct the new path, to simplifying the resolution of links on a Gemini capsule page.
  • Basic decoding of body responses on successful (20) response from Gemini servers.
  • Trust-on-first-use certificate verification handling scheme using key signatures.
  • Fully-featured response objects for each response type.
  • Standardized & robust, human-readable error management.
  • Custom error handling for networking failure cases beyond the scope of the protocol.

❌ The following Gemini features will not be supported by Ignition:

  • Behavioral processing/handling of specific response types from Gemini capsules, including:
    • Generation of client certificates & automatic resubmission.
    • Automatic redirection following on 3x responses.
  • Advanced body response rendering and/or display of text/gemini mime types.
  • Command line or GUI interface.
  • Advanced session & history management.
  • Support for other protocols.

⚠ These features are not currently supported but may be supported in the future:

  • Non-verified certificate scheme
  • Improved TOFU scenarios

Advanced Usage

More advanced request usage:

import ignition

response = ignition.request('/software', referer='//gemini.circumlunar.space:1965')

print("Got back response %s from %s" % (response.status, response.url))
# Got back a response 20 from gemini://gemini.circumlunar.space/software

if not response.success():
  print("There was an error on the response.")
else:
  print(response.data())

Passing a referer:

import ignition

response1 = ignition.request('//gemini.circumlunar.space')
response2 = ignition.request('software', referer=response1.url)

print(response2)

source

More advanced response validation:

import ignition

url = '//gemini.circumlunar.space'
response = ignition.request(url)

if response.is_a(ignition.SuccessResponse):
  print('Success!')
  print(response.data())

elif response.is_a(ignition.InputResponse):
  print('Needs additional input: %s' % (response.data()))

elif response.is_a(ignition.RedirectResponse):
  print('Received response, redirect to: %s' % (response.data()))

elif response.is_a(ignition.TempFailureResponse):
  print('Error from server: %s' % (response.data()))

elif response.is_a(ignition.PermFailureResponse):
  print('Error from server: %s' % (response.data()))

elif response.is_a(ignition.ClientCertRequiredResponse):
  print('Client certificate required. %s' % (response.data()))

elif response.is_a(ignition.ErrorResponse):
  print('There was an error on the request: %s' % (response.data()))

source

Finally, the module exposes DEBUG level logging via standard python capabilities. If you are having trouble with the requests, enable debug-level logging with:

import logging
logging.basicConfig(level=logging.DEBUG)

API Documentation

Full API documentation for Ignition is available here.

Developers

There are a few reports from the pilots.  They are simply identifying their flight plan very carefully.  Four minutes into the flight, Gordon Cooper just told Grissom that he is looking mighty good.  Gus gave him a reasuring laugh.  A very calm pilot in command of that spacecraft.

Want to help contribute to Ignition? See the developer documentation for contribution guidelines, build processes, and testing.

The developer documentation is still being completed, if you have specific questions, please open tickets within this project.

License

Ignition is licensed under Mozilla Public License 2.0.

Copyright 2020-2022 by Chris Brousseau.

Thank you

  • solderpunk for leading the design of the Gemini protocol, without which this project would not have been possible.
  • Sean Conman for writing the Gemini torture tests, which were instrumental in initial client testing.
  • Michael Lazar for his work on Jetforce, which helped testing along the way.

🔭 Happy exploring!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ignition-gemini-0.1.12.tar.gz (81.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ignition_gemini-0.1.12-py3-none-any.whl (87.1 kB view details)

Uploaded Python 3

File details

Details for the file ignition-gemini-0.1.12.tar.gz.

File metadata

  • Download URL: ignition-gemini-0.1.12.tar.gz
  • Upload date:
  • Size: 81.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for ignition-gemini-0.1.12.tar.gz
Algorithm Hash digest
SHA256 a4d45db88d9152d3117a4d5fd4e0acff345253c20115961f8cb9a3d260b0d1cd
MD5 5bc82955b1564ec3f28b3db269b5b22b
BLAKE2b-256 6490a276fa7c48d59ed8a5f1c7615bfae673d138cd3b476f36703a1a0ed60e34

See more details on using hashes here.

File details

Details for the file ignition_gemini-0.1.12-py3-none-any.whl.

File metadata

File hashes

Hashes for ignition_gemini-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 ea265e10a8053f5608505b6ab3ec6704ccfc3b9843d48f6ac313505a8955a21e
MD5 4d6ea30c91958f25de1b645c8fea1dea
BLAKE2b-256 39558e37638cc0398f82631bf4e306f04003026bbf7e023cb6d8fd059717f59a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page