{"id":19204619,"url":"https://github.com/openttd/bananas-api","last_synced_at":"2025-07-29T10:07:40.579Z","repository":{"id":37086206,"uuid":"247276268","full_name":"OpenTTD/bananas-api","owner":"OpenTTD","description":"OpenTTD's content service API (BaNaNaS API)","archived":false,"fork":false,"pushed_at":"2025-04-01T14:31:08.000Z","size":614,"stargazers_count":3,"open_issues_count":21,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-20T14:42:57.061Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenTTD.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-03-14T12:53:57.000Z","updated_at":"2025-02-15T08:49:14.000Z","dependencies_parsed_at":"2024-01-04T10:31:55.770Z","dependency_job_id":"af23c328-c435-45f3-bbf3-3bcc3cef5ac7","html_url":"https://github.com/OpenTTD/bananas-api","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fbananas-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fbananas-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fbananas-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTTD%2Fbananas-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenTTD","download_url":"https://codeload.github.com/OpenTTD/bananas-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253767804,"owners_count":21961189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-09T13:08:57.397Z","updated_at":"2025-05-12T15:47:06.802Z","avatar_url":"https://github.com/OpenTTD.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BaNaNaS API\n\n[![GitHub License](https://img.shields.io/github/license/OpenTTD/bananas-api)](https://github.com/OpenTTD/bananas-api/blob/main/LICENSE)\n\nThis is the HTTP API for OpenTTD's content service, called BaNaNaS.\nIt works together with [bananas-server](https://github.com/OpenTTD/bananas-server), which serves the in-game client.\n\nSee [introduction.md](docs/introduction.md) for more documentation about the different BaNaNaS components and how they work together.\n\nThe API is documented on [SwaggerHub](https://app.swaggerhub.com/apis-docs/OpenTTD/OpenTTD-content-api/1.0.0).\n\n## Development\n\nThis API is written in Python 3.11 with aiohttp, and makes strong use of asyncio.\n\n### Running a local server\n\n#### Dependencies\n\n- Python3.11 or higher.\n- [tusd](https://github.com/tus/tusd). For example, copy the `tusd` binary in your `~/.local/bin`.\n\n#### Preparing your venv\n\nTo start it, you are advised to first create a virtualenv:\n\n```bash\npython3 -m venv .env\n.env/bin/pip install -r requirements.txt\npython setup.py install\n```\n\n#### Starting a local server\n\nYou can start the HTTP server by running:\n\n```bash\n.env/bin/python -m bananas_api --web-port 8080 --tusd-port 1080 --storage local --index local --user developer --client-file clients-development.yaml\n```\n\nThis will start the API on port 8080 for you to work with locally.\n\n### Running via docker\n\n```bash\ndocker build -t openttd/bananas-api:local .\nexport BANANAS_COMMON=$(pwd)/../bananas-common\nmkdir -p \"${BANANAS_COMMON}/local_storage\" \"${BANANAS_COMMON}/BaNaNaS\"\ndocker run --rm -p 127.0.0.1:8080:80 -p 127.0.0.1:1080:1080 -v \"${BANANAS_COMMON}/local_storage:/code/local_storage\" -v \"${BANANAS_COMMON}/BaNaNaS:/code/BaNaNaS\" openttd/bananas-api:local\n```\n\nThe mount assumes that [bananas-server](https://github.com/OpenTTD/bananas-server) and this repository has the same parent folder on your disk, as both servers need to read the same local storage.\n\n### Files upload (tusd)\n\ntusd runs on its own port (1080 by default), and listens on `/new-package/files`.\nWith other words: the webserver does not forward that URL to tusd.\nThis means that for clients, you need to contact two endpoints:\n\n- the web-port for everything except `/new-package/files`.\n- the tusd-port for `/new-package/files`.\n\nIn production the Load Balancer redirects the URLs to the right ports, but during development this is something to keep in mind.\n\n[bananas-frontend-cli](https://github.com/OpenTTD/bananas-frontend-cli) for example allows you to define the web-endpoint and the tusd-endpoint.\n\n## Regions\n\nTo unify the way authors indicate what region their content is about, we have a built-in list of supported regions.\nThis is a combination of the [UN M49](https://unstats.un.org/unsd/methodology/m49/overview) list and ISO 3166-1 / 3166-2 list.\n\n- The 3166-1 / 3166-2 list is easiest found in the Debian `iso-codes` package, after which it is located in `/usr/share/iso-codes/json/iso_3166-[12].json`.\n- The UN M49 can be found [here](https://unstats.un.org/unsd/methodology/m49/overview).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenttd%2Fbananas-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenttd%2Fbananas-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenttd%2Fbananas-api/lists"}