{"id":16942320,"url":"https://github.com/steiza/txroutes","last_synced_at":"2025-04-11T19:32:41.279Z","repository":{"id":1180901,"uuid":"1080116","full_name":"steiza/txroutes","owner":"steiza","description":"Provides routes-like dispatching for twisted.web.server","archived":false,"fork":false,"pushed_at":"2022-03-28T22:10:16.000Z","size":11,"stargazers_count":10,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-25T15:21:20.621Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steiza.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2010-11-15T01:56:13.000Z","updated_at":"2021-02-11T22:23:06.000Z","dependencies_parsed_at":"2022-08-16T12:25:32.869Z","dependency_job_id":null,"html_url":"https://github.com/steiza/txroutes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steiza%2Ftxroutes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steiza%2Ftxroutes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steiza%2Ftxroutes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steiza%2Ftxroutes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steiza","download_url":"https://codeload.github.com/steiza/txroutes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248466970,"owners_count":21108571,"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-10-13T21:11:35.139Z","updated_at":"2025-04-11T19:32:41.255Z","avatar_url":"https://github.com/steiza.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Note\n====\n\nThis is a legacy project! For the most up-to-date version check out: https://github.com/olark/txroutes\n\n\n\ntxroutes\n========\n\ntxroutes provides routes-like dispatching for twisted.web.server (it actually\ndepends upon the Python routes codebase).\n\nFrequently, it's much easier to describe your website layout using routes\ninstead of Resource from twisted.web.resource. This small library lets you\ndispatch with routes in your twisted.web application.\n\nUsage\n-----\n\nHere is an example of how to use txroutes::\n\n    from twisted.internet import reactor, task\n    from twisted.web.server import Site, NOT_DONE_YET\n\n    from txroutes import Dispatcher\n\n\n    # Create a Controller\n    class Controller(object):\n\n        def index(self, request):\n            return '\u003chtml\u003e\u003cbody\u003eHello World!\u003c/body\u003e\u003c/html\u003e'\n\n        def docs(self, request, item):\n            return '\u003chtml\u003e\u003cbody\u003eDocs for %s\u003c/body\u003e\u003c/html\u003e' % item.encode('utf8')\n\n        def post_data(self, request):\n            return '\u003chtml\u003e\u003cbody\u003eOK\u003c/body\u003e\u003c/html\u003e'\n\n        def deferred_example(self, request):\n            request.write('\u003chtml\u003e\u003cbody\u003eWait a tic...\u003c/body\u003e\u003c/html\u003e')\n            task.deferLater(reactor, 5, lambda: request.finish())\n\n            return NOT_DONE_YET\n\n    c = Controller()\n\n    dispatcher = Dispatcher()\n\n    dispatcher.connect(name='index', route='/', controller=c, action='index')\n\n    dispatcher.connect(name='docs', route='/docs/{item}', controller=c,\n            action='docs')\n\n    dispatcher.connect(name='data', route='/data', controller=c,\n            action='post_data', conditions=dict(method=['POST']))\n\n    dispatcher.connect(name='deferred_example', route='/wait', controller=c,\n            action='deferred_example')\n\n    factory = Site(dispatcher)\n    reactor.listenTCP(8000, factory)\n    reactor.run()\n\nLicense\n-------\ntxroutes is released under the `MIT License`__\n\n__ http://opensource.org/licenses/MIT\n\nAdditional Information\n----------------------\n- Python routes: http://routes.groovie.org/\n- Using twisted.web.resources: http://twistedmatrix.com/documents/current/web/howto/web-in-60/dynamic-dispatch.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteiza%2Ftxroutes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteiza%2Ftxroutes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteiza%2Ftxroutes/lists"}