{"id":13937608,"url":"https://github.com/vfaronov/turq","last_synced_at":"2025-07-19T23:33:23.693Z","repository":{"id":5534243,"uuid":"6736964","full_name":"vfaronov/turq","owner":"vfaronov","description":"Mock HTTP server","archived":true,"fork":false,"pushed_at":"2018-12-22T17:43:52.000Z","size":374,"stargazers_count":68,"open_issues_count":2,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-09-20T05:41:51.042Z","etag":null,"topics":["api","debug","http","mock","rest","server","testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vfaronov.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","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":"2012-11-17T16:05:29.000Z","updated_at":"2023-12-25T22:11:29.000Z","dependencies_parsed_at":"2022-08-19T14:01:04.727Z","dependency_job_id":null,"html_url":"https://github.com/vfaronov/turq","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfaronov%2Fturq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfaronov%2Fturq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfaronov%2Fturq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfaronov%2Fturq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfaronov","download_url":"https://codeload.github.com/vfaronov/turq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226700623,"owners_count":17668678,"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":["api","debug","http","mock","rest","server","testing"],"created_at":"2024-08-07T23:03:43.394Z","updated_at":"2024-11-27T06:30:35.304Z","avatar_url":"https://github.com/vfaronov.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Turq\n====\n\n.. warning::\n\n   Turq is no longer maintained nor used by its author.\n   Try `mitmproxy`__ with `scripting`__ instead.\n   See also https://gist.github.com/vfaronov/3f7848932ed96a264c382902262ce7b3\n\n   __ https://mitmproxy.org/\n   __ https://docs.mitmproxy.org/stable/addons-scripting/\n\nTurq is a small HTTP server that can be scripted in a Python-based language.\nUse it to set up **mock HTTP resources** that respond with the status, headers,\nand body of your choosing. Turq is designed for **quick interactive testing**,\nbut can be used in automated scenarios as well.\n\n\nLets you do things like\n-----------------------\n\n\"RESTful API\" resource with cross-origin support::\n\n    if route('/v1/products/:product_id'):\n        if GET or HEAD:\n            json({'id': product_id, 'inStock': True})\n        elif PUT:\n            json(request.json)      # As if we saved it\n        elif DELETE:\n            status(204)\n        cors()      # Handles preflight requests automatically\n\nRedirect to an ``index.php``, which serves a gzipped, cacheable page\nafter 3 seconds of \"loading\"::\n\n    if path == '/':\n        redirect('/index.php')\n\n    if path == '/index.php':\n        sleep(3)\n        html()\n        gzip()\n        header('Cache-Control', 'max-age=3600')\n\nStream `server-sent events`_::\n\n    header('Content-Type', 'text/event-stream')\n    for i in range(9000):\n        sleep(1)\n        chunk('data: event number %d\\r\\n\\r\\n' % i)\n\n.. _server-sent events: https://en.wikipedia.org/wiki/Server-sent_events\n\n\nBuilt-in editor\n---------------\n\nYou don't even need to create any files, just use the built-in Web editor:\n\n.. image:: screenshot.png\n\n\nGet it now\n----------\n\nIn any Python 3.4+ environment::\n\n    $ pip3 install turq\n    $ turq\n\n`Read the docs \u003chttp://turq.readthedocs.io/\u003e`_ for more.\n\n\nThanks\n------\n\n`BrowserStack`_ have kindly provided a free subscription for testing Turq.\n\n.. _BrowserStack: https://www.browserstack.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfaronov%2Fturq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfaronov%2Fturq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfaronov%2Fturq/lists"}