ignition-gemini


Nameignition-gemini JSON
Version 0.2.0 PyPI version JSON
download
home_page
Summaryignition - Gemini Protocol Client Transport Library
upload_time2023-07-20 23:18:24
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMPL 2.0
keywords client gemini networking request socket
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # 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.](docs/img/transcript-1.png)

Ignition is a simple but powerful transport library for Python3 clients using the recently designed [Gemini protocol](https://gemini.circumlunar.space/). This project intends to implement all of the [transport specifications](https://gemini.circumlunar.space/docs/specification.html) (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](https://requests.readthedocs.io/en/master/) 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)](https://img.shields.io/github/v/release/cbrews/ignition?label=ignition)
[![CI v2](https://github.com/cbrews/ignition/actions/workflows/ci-v2.yml/badge.svg)](https://github.com/cbrews/ignition/actions/workflows/ci-v2.yml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ignition-gemini)
![PyPI - License](https://img.shields.io/pypi/l/ignition-gemini)

![The status is good to go.  This is Gemini Control.](docs/img/transcript-2.png)

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](https://gemini.cbrews.xyz).

## Installation
⚠ Ignition currently supports Python versions 3.7 - 3.11.

Ignition can be installed via [PIP](https://pypi.org/project/ignition-gemini/).  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](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)

```bash
pip install ignition-gemini
```

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

```bash
git clone https://github.com/cbrews/ignition.git
cd ignition
pip 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:
```python
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](examples/simple_usage.py)

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.](docs/img/transcript-3.png)

✅ 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](https://tools.ietf.org/html/rfc3986)
* 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:

```python
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:
```python
import ignition

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

print(response2)
```
[source](examples/using_referer.py)

More advanced response validation:
```python
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](examples/advanced_usage.py)

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

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

## API Documentation
Full API documentation for Ignition is available [here](./docs/api.md).

## 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.](docs/img/transcript-4.png)

Want to help contribute to Ignition?  See the [developer documentation](./docs/developer.md) 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](https://www.mozilla.org/en-US/MPL/).

Copyright 2020-2022 by [Chris Brousseau](https://github.com/cbrews).

## Thank you
* *solderpunk* for leading the design of the [Gemini protocol](https://gemini.circumlunar.space/docs/specification.html), without which this project would not have been possible.
* *Sean Conman* for writing the [Gemini torture tests](gemini://gemini.conman.org/test/torture), which were instrumental in initial client testing.
* *Michael Lazar* for his work on [Jetforce](https://github.com/michael-lazar/jetforce), which helped testing along the way.

🔭 Happy exploring!

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ignition-gemini",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "client,gemini,networking,request,socket",
    "author": "",
    "author_email": "Chris Brousseau <cbrews@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/91/12/8ae1335f9432c1358c4e98094f9635e612309d7a0637815748436be9574e/ignition_gemini-0.2.0.tar.gz",
    "platform": null,
    "description": "# Ignition: Python3 Gemini Protocol Client Transport Library\n\n![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.](docs/img/transcript-1.png)\n\nIgnition is a simple but powerful transport library for Python3 clients using the recently designed [Gemini protocol](https://gemini.circumlunar.space/). This project intends to implement all of the [transport specifications](https://gemini.circumlunar.space/docs/specification.html) (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.\n\nIf you're building a Python3 application that uses Gemini, Ignition is your gateway to the stars, in very much the same way that [requests](https://requests.readthedocs.io/en/master/) is for HTTP and **gopherlib** is for Gopher.\n\nIn 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.\n\nIn addition, in order to provide stability and simplicity, minimal third-party dependencies are required for Ignition.\n\n## Project Status\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/cbrews/ignition?label=ignition)\n[![CI v2](https://github.com/cbrews/ignition/actions/workflows/ci-v2.yml/badge.svg)](https://github.com/cbrews/ignition/actions/workflows/ci-v2.yml)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ignition-gemini)\n![PyPI - License](https://img.shields.io/pypi/l/ignition-gemini)\n\n![The status is good to go.  This is Gemini Control.](docs/img/transcript-2.png)\n\nIgnition 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.\n\nYou can see ignition in action at [gemini.cbrews.xyz](https://gemini.cbrews.xyz).\n\n## Installation\n\u26a0 Ignition currently supports Python versions 3.7 - 3.11.\n\nIgnition can be installed via [PIP](https://pypi.org/project/ignition-gemini/).  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](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)\n\n```bash\npip install ignition-gemini\n```\n\nIf you prefer to install from source, you can clone and install the repository:\n\n```bash\ngit clone https://github.com/cbrews/ignition.git\ncd ignition\npip install .\n```\n\n## Simple Usage\nThe most basic usage of Ignition allows the user to create a request and get a response back from a remote Gemini capsule:\n```python\nimport ignition\n\n# Fetch capsule content\nresponse = ignition.request('//gemini.circumlunar.space')\n\n# Get status from remote capsule\nprint(response.status)\n\n# Get response information from remote capsule\nprint(response.data())\n```\n[source](examples/simple_usage.py)\n\nIn **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.\n\n## Key Features\n\n![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.](docs/img/transcript-3.png)\n\n\u2705 Ignition currently supports the following features:\n* Basic request/response connectivity to a Gemini-enabled server.\n* Basic URL parsing mechanics to allow for specifying protocol, host, port, path, and query params, as per [RFC-3986](https://tools.ietf.org/html/rfc3986)\n* 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.\n* Basic decoding of body responses on successful (20) response from Gemini servers.\n* Trust-on-first-use certificate verification handling scheme using key signatures.\n* Fully-featured response objects for each response type.\n* Standardized & robust, human-readable error management.\n* Custom error handling for networking failure cases beyond the scope of the protocol.\n\n\u274c The following Gemini features will *not* be supported by Ignition:\n* Behavioral processing/handling of specific response types from Gemini capsules, including:\n  * Generation of client certificates & automatic resubmission.\n  * Automatic redirection following on 3x responses.\n* Advanced body response rendering and/or display of text/gemini mime types.\n* Command line or GUI interface.\n* Advanced session & history management.\n* Support for other protocols.\n\n\u26a0 These features are not currently supported but may be supported in the future:\n* Non-verified certificate scheme\n* Improved TOFU scenarios\n\n## Advanced Usage\nMore advanced request usage:\n\n```python\nimport ignition\n\nresponse = ignition.request('/software', referer='//gemini.circumlunar.space:1965')\n\nprint(\"Got back response %s from %s\" % (response.status, response.url))\n# Got back a response 20 from gemini://gemini.circumlunar.space/software\n\nif not response.success():\n  print(\"There was an error on the response.\")\nelse:\n  print(response.data())\n```\n\nPassing a referer:\n```python\nimport ignition\n\nresponse1 = ignition.request('//gemini.circumlunar.space')\nresponse2 = ignition.request('software', referer=response1.url)\n\nprint(response2)\n```\n[source](examples/using_referer.py)\n\nMore advanced response validation:\n```python\nimport ignition\n\nurl = '//gemini.circumlunar.space'\nresponse = ignition.request(url)\n\nif response.is_a(ignition.SuccessResponse):\n  print('Success!')\n  print(response.data())\n\nelif response.is_a(ignition.InputResponse):\n  print('Needs additional input: %s' % (response.data()))\n\nelif response.is_a(ignition.RedirectResponse):\n  print('Received response, redirect to: %s' % (response.data()))\n\nelif response.is_a(ignition.TempFailureResponse):\n  print('Error from server: %s' % (response.data()))\n\nelif response.is_a(ignition.PermFailureResponse):\n  print('Error from server: %s' % (response.data()))\n\nelif response.is_a(ignition.ClientCertRequiredResponse):\n  print('Client certificate required. %s' % (response.data()))\n\nelif response.is_a(ignition.ErrorResponse):\n  print('There was an error on the request: %s' % (response.data()))\n```\n[source](examples/advanced_usage.py)\n\nFinally, the module exposes `DEBUG` level logging via standard python capabilities.  If you are having trouble with the requests, enable debug-level logging with:\n\n```python\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n```\n\n## API Documentation\nFull API documentation for Ignition is available [here](./docs/api.md).\n\n## Developers\n\n![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.](docs/img/transcript-4.png)\n\nWant to help contribute to Ignition?  See the [developer documentation](./docs/developer.md) for contribution guidelines, build processes, and testing.\n\nThe developer documentation is still being completed, if you have specific questions, please open tickets within this project.\n\n## License\nIgnition is licensed under [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/).\n\nCopyright 2020-2022 by [Chris Brousseau](https://github.com/cbrews).\n\n## Thank you\n* *solderpunk* for leading the design of the [Gemini protocol](https://gemini.circumlunar.space/docs/specification.html), without which this project would not have been possible.\n* *Sean Conman* for writing the [Gemini torture tests](gemini://gemini.conman.org/test/torture), which were instrumental in initial client testing.\n* *Michael Lazar* for his work on [Jetforce](https://github.com/michael-lazar/jetforce), which helped testing along the way.\n\n\ud83d\udd2d Happy exploring!\n",
    "bugtrack_url": null,
    "license": "MPL 2.0",
    "summary": "ignition - Gemini Protocol Client Transport Library",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/cbrews/ignition"
    },
    "split_keywords": [
        "client",
        "gemini",
        "networking",
        "request",
        "socket"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de977a9d0d0930e3d5f10917fb957af5b4acb1d5cb6d7481b46c018f4302b4d7",
                "md5": "8cf4aa153853728f7f70b072a272aa31",
                "sha256": "2a7b1be40ef0f24c824499cefad2bdce44da00a73b0891c9b196eb9abe184497"
            },
            "downloads": -1,
            "filename": "ignition_gemini-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8cf4aa153853728f7f70b072a272aa31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 87503,
            "upload_time": "2023-07-20T23:18:23",
            "upload_time_iso_8601": "2023-07-20T23:18:23.308705Z",
            "url": "https://files.pythonhosted.org/packages/de/97/7a9d0d0930e3d5f10917fb957af5b4acb1d5cb6d7481b46c018f4302b4d7/ignition_gemini-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91128ae1335f9432c1358c4e98094f9635e612309d7a0637815748436be9574e",
                "md5": "9445e0657d8d24468a2e16d0e1199246",
                "sha256": "dd703a4fa4f4ab4112413f75feba7f0b06b0ed8fd290342cc1dbcd7079384c07"
            },
            "downloads": -1,
            "filename": "ignition_gemini-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9445e0657d8d24468a2e16d0e1199246",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 76847,
            "upload_time": "2023-07-20T23:18:24",
            "upload_time_iso_8601": "2023-07-20T23:18:24.484017Z",
            "url": "https://files.pythonhosted.org/packages/91/12/8ae1335f9432c1358c4e98094f9635e612309d7a0637815748436be9574e/ignition_gemini-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-20 23:18:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cbrews",
    "github_project": "ignition",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "ignition-gemini"
}
        
Elapsed time: 0.09336s