{"id":13770948,"url":"https://github.com/brunobord/gemeaux","last_synced_at":"2026-03-05T08:02:29.371Z","repository":{"id":40652760,"uuid":"317601469","full_name":"brunobord/gemeaux","owner":"brunobord","description":"Gemeaux: a Python Gemini Server","archived":false,"fork":false,"pushed_at":"2025-04-06T19:50:17.000Z","size":89,"stargazers_count":21,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-06T21:34:55.084Z","etag":null,"topics":["gemini","gemini-protocol"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brunobord.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-01T16:27:45.000Z","updated_at":"2025-12-17T03:12:09.000Z","dependencies_parsed_at":"2025-04-12T06:31:24.169Z","dependency_job_id":"7e24e087-f760-454b-8437-7bd309a28571","html_url":"https://github.com/brunobord/gemeaux","commit_stats":{"total_commits":50,"total_committers":1,"mean_commits":50.0,"dds":0.0,"last_synced_commit":"af517a38762e17ee7da5224e286a94b66680a3a5"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/brunobord/gemeaux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobord%2Fgemeaux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobord%2Fgemeaux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobord%2Fgemeaux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobord%2Fgemeaux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunobord","download_url":"https://codeload.github.com/brunobord/gemeaux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobord%2Fgemeaux/sbom","scorecard":{"id":255264,"data":{"date":"2025-08-11","repo":{"name":"github.com/brunobord/gemeaux","commit":"cb7ea91aded69b345b53db1a354fa7a4142317b4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/tox-tests.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox-tests.yaml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/brunobord/gemeaux/tox-tests.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox-tests.yaml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/brunobord/gemeaux/tox-tests.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox-tests.yaml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/brunobord/gemeaux/tox-tests.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tox-tests.yaml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/brunobord/gemeaux/tox-tests.yaml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/tox-tests.yaml:14","Warn: pipCommand not pinned by hash: .github/workflows/tox-tests.yaml:33","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 0.0.3 not signed: https://api.github.com/repos/brunobord/gemeaux/releases/210620286","Warn: release artifact 0.0.3 does not have provenance: https://api.github.com/repos/brunobord/gemeaux/releases/210620286"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T09:32:48.700Z","repository_id":40652760,"created_at":"2025-08-17T09:32:48.700Z","updated_at":"2025-08-17T09:32:48.700Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30115662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gemini","gemini-protocol"],"created_at":"2024-08-03T17:00:45.289Z","updated_at":"2026-03-05T08:02:29.266Z","avatar_url":"https://github.com/brunobord.png","language":"Python","funding_links":[],"categories":["Servers"],"sub_categories":["Graphical"],"readme":"# Gemeaux: a Python Gemini Server\n\n![Python tests](https://github.com/brunobord/gemeaux/actions/workflows/tox-tests.yaml/badge.svg)\n\n[![PyPI version of gemeaux](https://badge.fury.io/py/gemeaux.svg)](https://pypi.python.org/pypi/gemeaux/) [![PyPI license](https://img.shields.io/pypi/l/gemeaux.svg)](https://pypi.python.org/pypi/gemeaux/) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/gemeaux.svg)](https://pypi.python.org/pypi/gemeaux/)\n\nThe [Gemini protocol](https://gemini.circumlunar.space/) is an ongoing initiative to build a clutter-free content-focused Internet browsing, *à la* [Gopher](https://en.wikipedia.org/wiki/Gopher_(protocol)), but modernized. It focuses on Privacy (TLS + no user tracking) and eliminates the fluff around the modern web: cookies, ads, overweight Javascript apps, browser incompatibilities, etc.\n\nIt has been designed for enabling a developer to build a client or a server within a few hours of work. I have been able to serve Gemini static content after two afternoons, so I guess I'm an average developer. But after that, I've tried to improve it, make it more flexible and extensible.\n\nSo, here it is: the `Gemeaux` server.\n\n**IMPORTANT NOTE**: since this project is still in its earliest stages, it's worth saying that this software **IS DEFINITELY NOT READY FOR PRODUCTION** — and would probably never will ;o).\n\n## Clients\n\nA quick word about Gemini protocol. Since it's a different protocol from HTTP, or Gopher, or FTP, etc., it means that you'll have to drop your beloved Web Browser to access Gemini content. Hopefully, several clients are available.\n\n* [A list of clients on the canonical Gemini Space](https://geminiprotocol.net/clients.html)\n* [A curated list of clients on \"awesome Gemini\"](https://github.com/kr1sp1n/awesome-gemini#clients)\n\nDownload and install a couple of clients, pick one that fits your needs, or if you feel like it, build one yourself, and you'll be ready to spacewalk the Gemini ecosystem.\n\nFor development purposes, I'd recommend [bollux](https://tildegit.org/acdw/bollux), a browser made for bash, because it displays helpful debug messages (and it's as fast as you can dream).\n\n## Requirements\n\n`Gemeaux` is built around **the standard Python 3.9+ library** and syntax. There are **no external dependencies**.\n\nAutomated tests are launched using Python 3.9, 3.10, 3.11, 3.12 and 3.13 so the internals of `Gemeaux` are safe with these versions of Python.\n\nYou'll also need `openssl` to generate certificates.\n\n## Quickstart\n\n### Install via PyPI\n\nTo install the latest release of `gemeaux` package, inside a virtualenv, or in a safe environment, run the following:\n\n```sh\npip install gemeaux\n```\n\n### Developer mode\n\n```sh\ngit clone https://github.com/brunobord/gemeaux.git\n# You may also want to use this source: git@github.com:brunobord/gemeaux.git\ncd gemeaux/\npip install -e .\n```\n\n### Generate certificates\n\nSince TLS is mandatory, you'll have to generate your own SSL certificate files. Use the following command to generate self-signed certificate files, targeting a localhost/developer mode:\n\n```sh\nmake cert\n```\n\nThis command will generate two files: `cert.pem` and `key.pem`.\n\nAgain, this will probably not be safe for production.\n\n### Usage\n\nThe \"hello world\" of this *proof of concept* would be to serve a directory containing an ``index.gmi`` file.\n\nFor example, the `index.gmi` can look like this:\n\n```\n# Hello World!\n\nLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor\nincididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\nnostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu\nfugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in\nculpa qui officia deserunt mollit anim id est laborum.\n```\n\nThen you'll create a python file (e.g.: `app.py`) containing the following:\n\n```python\nfrom gemeaux import App, StaticHandler\n\nif __name__ == \"__main__\":\n    urls = {\n        \"\": StaticHandler(\n            static_dir=\"path/to/your/directory/\"\n        ),\n    }\n    app = App(urls)\n    app.run()\n```\n\n*Note*: The `static_dir` argument can be a relative or an absolute path.\n\nThen you'll run your program using Python 3+:\n\n```sh\npython app.py\n```\n\nYou can then point your client at `gemini://localhost/` and you'll see the content of your home page.\n\nBy default, the application will listen at port `1965` on your `localhost` (`127.0.0.1`) host, and will use the previously generated `cert.pem` and `key.pem` files.\n\nIn order to open your server to \"the world\", you can change the `--ip` option like this:\n\n```sh\npython app.py --ip 0.0.0.0\n```\n\n**BIG WARNING**: opening your server to external connections is **DEFINITELY NOT A GOOD IDEA**, since this software **IS NOT PRODUCTION-READY**.\n\nYou can change the default configuration values using the optional arguments. For more details, run:\n\n```sh\npython app.py --help\n```\n\n## Advanced usage\n\nThe `urls` configuration is at the core of the application workflow. By combining the available `Handler` and `Response` classes, you have the ability to create more complex Gemini spaces.\n\nYou may read the example application, in the `example_app.py` file if you want to see an advanced usage of handlers \u0026 responses.\n\nSeveral classes are provided in this library. **All classes described below can be imported from the `gemeaux` module directly**, as in `from gemeaux import \u003cMyClass\u003e`.\n\n### Handlers\n\nMost of the time, when working with `Handler` basic classes, you'll have to implement/override two methods:\n\n* `Handler.__init__(*args, **kwargs)`: The class constructor will accept `args` and `kwargs` for providing parameters.\n* `Handler.get_response(*args, *kwargs)`: Based on the parameters and your current context, you would generate a Gemini-compatible response, either based on the `Response` classes provided, or ones you can build yourself.\n\n#### StaticHandler\n\nThis handler is used for serving a static directory and its subdirectories.\n\nHow to instantiate:\n\n```python\nStaticHandler(\n    static_dir,\n    directory_listing=True,\n    index_file=\"index.gmi\"\n)\n```\n\n* `static_dir`: the path (relative to your program or absolute) of the root directory to serve.\n* `directory_listing` (default: `True`): if set to `True`, in case there's no \"index file\" in a directory, the application will display the directory listing. If set to `False`, and if there's still no index file in this directory, it'll return a `NotFoundResponse` to the client.\n* `index_file` (default: `\"index.gmi\"`): when the client tries to reach a directory, it's this filename that would be searched to be rendered as the \"homepage\".\n\n*Note*: If your client is trying to reach a subdirectory like this: `gemini://localhost/subdirectory` (without the trailing slash), the client will receive a Redirection Response targetting `gemini://localhost/subdirectory/` (with the trailing slash).\n\n#### TemplateHandler\n\nThis handler provides methods to render Gemini content, mixing a text template and context variables.\n\nThe constructor has no specific arguments, but accepts `*args` and `**kwargs`. You'll have to overwrite/override two methods in order to correctly mix the template content with the context variables.\n\nTo retrieve the template file, you can overwrite/override the `get_template_file()` method:\n\n```python\nTemplateHandler.get_template_file()\n```\n\nAlternatively, you may assign it a static `template_file` attribute, like this:\n\n```python\nclass MyTemplateHandler(TemplateHandler):\n    template_file = \"/path/to/template.txt\"\n```\n\nThe template file name doesn't require a specific file extension. By default, `TemplateHandler` instances will use the [`string.Template` module from the standard library](https://docs.python.org/3/library/string.html#string.Template) to render content.\n\n**Note**: we know that this \"template engine\" is a bit too minimalist for advanced purposes ; but as this project mantra is \"no external dependencies\". Still, this project is a Python project ; so you can plug your favorite template engine and serve dynamic content the way you want.\n\nExample template:\n\n```\nI am a template file. Refresh me to see what time it is: $datetime\n```\n\nTo generate your context variable(s), you'll have to overwrite/override the `get_context()` method:\n\n```python\nclass DatetimeTemplateHandler(TemplateHandler):\n    template_file = \"/path/to/template.txt\"\n\n    def get_context(self, *args, **kwargs):\n        return {\"datetime\": datetime.datetime.now()}\n```\n\nThis `get_context()` method should return a dictionary. When accessed, the `$datetime` variable will be replaced by its value from the context dictionary.\n\n### Responses\n\nResponse classes are the direct links when it comes to returning content to the client. All responses are inheriting from the `gemeaux.responses.Response`.\nReponses are blocks of text, returned as Python `bytes` to the client via the communication socket. Responses are composed of two main elements:\n\n* the `meta` block: It's a line containing the status code (a two-digit code) and an (optional) meta text, in which you'll return the mimetype of the content for \"OK\" responses, while for error responses, you may also send a human-readable explanation about this error.\n* the `body`: if you're returning a \"OK\" response, this block will be the contents of your content (page, file, etc).\n\n**Note:** If you check with the Gemini project specification, you may see that some response types are missing. They'll eventually be added in a further release.\n\n#### 10: InputResponse\n\n*Usage*:\n\n```python\nInputResponse(prompt=\"What's your name?\")\n```\n\nThis response will prompt the user. When the user will answer the question, the client is supposed to send a new request, adding the answer to the prompt at the end of the originating URL. For example:\n\n* The client requests the \u003cgemini://localhost/register/\u003e\n* The server returns an `InputResponse` with the appropriate prompt.\n* The end-user may answer to the prompt. Let's say they enter \"Forty-Two\".\n* The client will then send a request to \u003cgemini://localhost/register/?Forty-Two\u003e\n\nIt's the integrator duty to proceed with the client answer, then.\n\n#### 11: SensitiveInputResponse\n\n*Usage*:\n\n```python\nSensitiveInputResponse(prompt=\"What's your name?\")\n```\n\nSame as for the `InputResponse`, except that your answer will be hidden on your client interface when you'll type it.\n\n#### 20: SuccessResponse\n\n*Usage*:\n\n```python\nSuccessResponse()\n```\n\nYou'll probably never use this response class directly, since it'll return no response body. It'll be your parent class for your custom responses, when the request is successful. See the Custom Responses below.\n\n#### 30: RedirectResponse\n\n*Usage*:\n\n```python\nRedirectResponse(target=\"gemini://localhost/moon/\")\n```\n\nThis class will send a Redirect response, with `target` being the next URL. This default redirection is supposed to be temporary, for example if it follows an application workflow.\n\n#### 31: PermanentRedirectResponse\n\n*Usage*:\n\n```python\nPermanentRedirectResponse(target=\"gemini://localhost/moon/base/\")\n```\n\nWhether the redirection is permanent or temporary, clients will behave alike. But crawlers and search engine spiders will consider the permanent redirections differently, and should remember to crawl the new target and deprecate the previous URL.\n\n#### 50: PermanentFailureResponse\n\n*Usage*:\n\n```python\nPermanentFailureResponse(reason=\"You forgot to say 'please'\")\n```\n\nYour application has failed for a \"good\" reason and it'll always fail when your user requests this resource this way. The `reason` argument is optional. If omitted, the message will read `50 PERMANENT FAILURE`.\n\n#### 51: NotFoundResponse\n\n*Usage*:\n\n```python\nNotFoundResponse(reason=\"These are not the droids you are looking for\")\n```\n\nThe requested resource is not found (its code is `51`, because you'll never find what's in the *Area 51*). The `reason` argument is optional. If omitted, the message will read `51 NOT FOUND`.\n\n#### 54: ProxyRequestRefusedResponse\n\n*Usage*:\n\n```python\nProxyRequestRefusedResponse()\n```\n\nThis response is returned when the server is receiving a query not directly related to its host(name).\n\n##### The proxy use case\n\nYou're building a Gemini server called `moonbase`. It receives requests for local resources, but you're allowing your server to act as a proxy for the server named `lunarstation`. It can be another Gemini server *or* an HTTP(s) server, or Gopher, etc. So if you allow it, you can authorize incoming requests for `https://lunarstation/example/resource`, fetch this resource by yourself, transcribe it into a regular Gemini `Response` and return it to your client.\n\nOtherwise, if you don't allow it, simply return the `ProxyRequestRefusedResponse` as described above.\n\n**Note:** The proxy feature is not implemented yet in ``Gemeaux``, but it's planned for a future release.\n\n#### 59: BadRequestResponse\n\n*Usage*:\n\n```python\nBadRequestResponse(reason=\"You've been very naughty, no cake for you\")\n```\n\nReturn this Bad Request response whenever the request doesn't fulfill the Gemini specs or is wrong in a way or another. The `reason` argument is optional. If omitted, the response will read: `59: BAD REQUEST`.\n\n### Custom Response classes\n\nIn order to ease development of Gemini websites / applications, *Gemeaux* is providing a few Response classes to return classic Gemini content.\n\n#### TextResponse\n\nThe text response is composed of a `title` and a `body` content. It's one of the most direct way to return Gemini markup. You may use it to return dynamic content.\n\nHere is an example:\n\n```python\nfrom random import randint\nfrom gemeaux import TextResponse\nresponse = TextResponse(\n    title=\"Fancy a game?\",\n  body=f\"Rolled: {randint(1, 6)}\\r\\nRefresh the page to make another roll.\"\n)\n```\n\nThe arguments `title` and `body` are both optional. But of course, returning an empty content can be puzzling for your users.\n\nThe `title` will be rendered as `# Fancy a game?`. The rest of the content (the `body` variable) will be flushed to the user. Please note that all combinations of `\\n` \u0026 `\\r` will be converted into `\\r\\n`.\n\n#### DocumentResponse\n\nAnother quick way to return Gemini content is write it down in a text file. You can then return your response to the client as if it was served by a static web server, except that it'll be a Gemini response.\n\nExample:\n\n```python\nDocumentResponse(\n    full_path=\"/var/gemini/content/file.gmi\",\n    root_dir=\"/var/gemini/content\"\n)\n```\n\nPlease note that both `full_path` and `root_dir` arguments are **mandatory**. The `root_dir` argument should prevent your application to try to access a file that doesn't belong to the root directory of your static content. You wouldn't like your `/etc/passwd` file to be revealed using a `DocumentResponse` instance, would you?\n\n#### DirectoryListingResponse\n\nOne may consider too annoying to make a homepage for a static directory yourself. The `DirectoryListingResponse` is providing you a way to display the list of the given directory.\n\nExample:\n\n```python\nDirectoryListingResponse(\n    full_path=\"/var/gemini/content/moon/base/\",\n    root_dir=\"/var/gemini/content\"\n)\n```\n\n**Note**: if the provided path is not a directory, or is not part of the `root_dir`path, a `FileNotFoundError` will be raised.\n\n#### TemplateResponse\n\nWhen you want your dynamic content to respect some sort of structure, you may want to leverage templates to avoid repeating yourself.\n\nThe `TemplateResponse` class constructor has one mandatory argument: `template_file`, which is the path to the template file. Then there's a `context` kwargs, that will be transmitted to the template.\n\nA template file is a text file that respects the [String subsitution API described here](https://docs.python.org/3/library/string.html#template-strings).\n\n*Example template:*\n\n```\nHello, $full_name! Welcome aboard.\n```\n\nNow let's imagine your `TemplateResponse` class is instantiated like this:\n\n```python\nTemplateResponse(\"/path/to/hello.txt\", full_name=\"Gus Grissom\")\n```\n\nWhen returned to the client as a Response, This will be rendered as:\n\n```\nHello, Gus Grissom! Welcome aboard.\n```\n\nYou can pass as many context variables as you want, but here are some important notes:\n\n1. For each template variable (like `$stuff`), you must give it a value.\n2. Basic Python types will be properly rendered, but the stdlib `string.Template` has no advanced template features: no loops over a list of items, etc. *There are plans to make it easier to plug your favorite template engine in the future (in the meantime, you can try to make the mix of your templates and dynamic variables in your Handler class and return a `TextResponse` yourself).*\n\n## Known bugs \u0026 limitations\n\nThis project is mostly for education purposes, although it can possibly be used through a local network, serving Gemini content. There are important steps \u0026 bugs to fix before becoming a more solid alternative to other Gemini server software.\n\n* The internals of `Gemeaux` are being tested on Python3.9+, but not the mainloop mechanics.\n* The vast majority of Gemini Standard responses are not implemented.\n* The Response documentation is missing, along with docstrings.\n* Performances are probably very low, there might be room for optimisation.\n\n----\n\n## What's in the name?\n\n*\"Gémeaux\"* is the French word for *\"Gemini\"*. And incidentally, I was born a Gemini. In French it's pronounced \\\\ʒe.mo\\\\.\n\n*Disclaimer*: I don't believe in astrology.\n\n## Other projects\n\n* [Jetforce](https://github.com/michael-lazar/jetforce) is a Python-based Gemini server, using the Twisted framework.\n* [GeGoBi](https://tildegit.org/solderpunk/gegobi) uses a single Python file ; it's a dual-protocol server, for both Gopher \u0026 Gemini.\n\n## License\n\n`Gemeaux` server is distributed as Free Software under the terms of the MIT License. See the contents of the `LICENSE` file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunobord%2Fgemeaux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunobord%2Fgemeaux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunobord%2Fgemeaux/lists"}