{"id":13725142,"url":"https://github.com/emartech/escher-python","last_synced_at":"2025-08-17T08:31:10.503Z","repository":{"id":22392231,"uuid":"25729171","full_name":"emartech/escher-python","owner":"emartech","description":"Library for HTTP request signing (Python implementation)","archived":false,"fork":false,"pushed_at":"2024-06-07T14:02:26.000Z","size":75,"stargazers_count":5,"open_issues_count":9,"forks_count":3,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-07-28T06:10:34.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/emartech.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}},"created_at":"2014-10-25T11:25:21.000Z","updated_at":"2024-06-07T14:01:17.000Z","dependencies_parsed_at":"2024-04-22T06:54:09.508Z","dependency_job_id":null,"html_url":"https://github.com/emartech/escher-python","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/emartech/escher-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fescher-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fescher-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fescher-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fescher-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emartech","download_url":"https://codeload.github.com/emartech/escher-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fescher-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270822852,"owners_count":24652002,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-08-03T01:02:14.096Z","updated_at":"2025-08-17T08:31:10.244Z","avatar_url":"https://github.com/emartech.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"EscherPython - HTTP request signing lib [![Build Status](https://github.com/emartech/escher-python/actions/workflows/python.yml/badge.svg)](https://github.com/emartech/escher-python/actions)\n=======================================\n\nEscher helps you creating secure HTTP requests (for APIs) by signing HTTP(s) requests. It's both a server side and client side implementation. The status is work in progress.\n\nThe algorithm is based on [Amazon's _AWS Signature Version 4_](http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html), but we have generalized and extended it.\n\nMore details are available at [escherauth.io](http://escherauth.io/).\n\nSigning a request\n-----------------\n\nEscher works by calculating a cryptographic signature of your request, and adding it (and other authentication information) to said request.\n\nUsually you will want to add the authentication information to the request by appending extra headers to it.\n\n```python\nfrom escherauth import Escher\n\nrequest = {\n    'method': 'POST',\n    'url': '/',\n    'host': 'example.com',\n    'headers': [\n        ['X-Foo', 'bar'],\n    ],\n    'body': '{\"this_is\": \"a_request_body\"}',\n}\n\nescher = Escher('YOUR_ACCESS_KEY_ID', 'YOUR SECRET', 'example/credential/scope')\nsigned_request = escher.sign_request(request)\n\nfrom pprint import pprint\npprint(signed_request)\n```\n\nSigning a [Requests](https://requests.readthedocs.io/) request:\n\n```python\nimport requests\nfrom escherauth import EscherRequestsAuth\n\nauth = EscherRequestsAuth('YOUR_ACCESS_KEY_ID', 'YOUR SECRET', 'example/credential/scope')\nresponse = requests.post('https://httpbin.org/post', json={'this_is': 'a_request_body'}, auth=auth)\n\nfrom pprint import pprint\npprint(response.json())\n```\n\nPresigning a URL\n----------------\n\nIn some cases you may want to send authenticated requests from a context where you cannot modify the request headers, e.g. when embedding an API generated iframe.\n\nYou can however generate a presigned URL, where the authentication information is added to the query string.\n\n```python\nfrom escherauth import Escher\n\nescher = Escher('YOUR_ACCESS_KEY_ID', 'YOUR SECRET', 'example/credential/scope')\npresigned_url = escher.presign_url('http://example.com/', expires=300)\n\nprint(presigned_url)\n```\n\nValidating a request\n--------------------\n\nYou can validate a request signed by the methods described above. For that you will need a database of the access keys and secrets of your clients.\n\n```python\nfrom escherauth import Escher, EscherException\n\nescher = Escher('', '', 'example/credential/scope')\n\nsigned_request = {\n    'body': '{\"this_is\": \"a_request_body\"}',\n    'headers': [\n        ['Host', 'example.com'],\n        ['X-Escher-Date', '20240227T121443Z'],\n        ['X-Escher-Auth', 'ESR-HMAC-SHA256 Credential=YOUR_ACCESS_KEY_ID/20240227/example/credential/scope, SignedHeaders=host;x-escher-date, Signature=5febb099193b8e6c4027ff810e0faa5bc8a275efb46f2d5c1af8810f4332c4cb'],\n    ],\n    'method': 'POST',\n    'url': '/',\n}\nkey_db = {\n    'ACCESS_KEY_OF_CLIENT_1': 'SECRET OF CLIENT 1',\n    'ACCESS_KEY_OF_CLIENT_42': 'SECRET OF CLIENT 42',\n}\n\ntry:\n    escher.authenticate(signed_request, key_db)\n    print('OK')\nexcept EscherException as e:\n    print(f'The validation failed: {e}')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Fescher-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femartech%2Fescher-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Fescher-python/lists"}