{"id":17932362,"url":"https://github.com/meain/synapse","last_synced_at":"2025-04-03T10:43:53.262Z","repository":{"id":114799957,"uuid":"131815250","full_name":"meain/synapse","owner":"meain","description":"Easily make python function into a rest api. Just add a wrapper `@synapse`","archived":false,"fork":false,"pushed_at":"2018-06-13T06:44:02.000Z","size":10,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T00:18:02.116Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-05-02T07:36:59.000Z","updated_at":"2018-06-13T06:44:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5070fa0-0f49-4166-96d5-78eb10e3d29e","html_url":"https://github.com/meain/synapse","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/meain%2Fsynapse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meain%2Fsynapse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meain%2Fsynapse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meain%2Fsynapse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meain","download_url":"https://codeload.github.com/meain/synapse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246989505,"owners_count":20865305,"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-28T21:26:31.644Z","updated_at":"2025-04-03T10:43:53.230Z","avatar_url":"https://github.com/meain.png","language":"Python","readme":"# Synapse\n\nA super simple way to convert your python function into a rest api.\n\n*Python is simple, flask is simpler, synapse is even simpler*\n\n**Falsk with better defaults**\n\n\u003e Not sure if this needed though. Might be micro optimizing. Most probably\n\n## Model\n\n- accepts json ( only json for now )\n- passes each key to corresponding function arguments\n- returns dict returned back as json\n\n## Deps\n\n- `flask`\n- `flask_cors`\n\n## Sample usage\n\n```python\nfrom synapse import Synapse\n\nsynapse = Synapse()\n\n@synapse.connect('/robo')\ndef robo(name, robot=False):\n    if robot:\n        return f\"{name} is a robot\"\n    else:\n        return f\"{name} is not a robot\"\n\nsynapse.start()\n```\n\n### Ideal condition\nFor this if you send\n```bash\ncurl --header \"Content-Type: application/json\" \\\n  --request POST \\\n  --data '{\"name\": \"meain\", \"robot\": true}' \\\n  http://localhost:8080/robo\n```\nyou get\n```js\n{\n  \"data\": \"meain is a robot\",\n  \"success\": true\n}\n```\n\n### Error condition\n\nIt has basic error check for now. So if you send\n```bash\ncurl --header \"Content-Type: application/json\" \\\n  --request POST \\\n  --data '{\"nxame\": \"meain\"}' \\\n  http://localhost:8080/robo\n```\n\nyou get\n```js\n{\n  \"error\": \"Keys ['name'] not found\",\n  \"success\": false\n}\n```\n\n## TODO\n\u003e For TODO check `todo/`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeain%2Fsynapse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeain%2Fsynapse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeain%2Fsynapse/lists"}