{"id":50783596,"url":"https://github.com/consbio/restle","last_synced_at":"2026-06-12T05:31:14.777Z","repository":{"id":25254172,"uuid":"28679204","full_name":"consbio/restle","owner":"consbio","description":"A REST client framework","archived":false,"fork":false,"pushed_at":"2020-07-22T23:56:08.000Z","size":237,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-29T11:12:37.459Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/consbio.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}},"created_at":"2015-01-01T02:30:20.000Z","updated_at":"2021-02-24T23:10:09.000Z","dependencies_parsed_at":"2022-08-24T00:20:47.106Z","dependency_job_id":null,"html_url":"https://github.com/consbio/restle","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/consbio/restle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2Frestle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2Frestle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2Frestle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2Frestle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/consbio","download_url":"https://codeload.github.com/consbio/restle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consbio%2Frestle/sbom","scorecard":{"id":302996,"data":{"date":"2025-08-11","repo":{"name":"github.com/consbio/restle","commit":"1235d3da4926e78465302560eb6b5a389156a472"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: PYSEC-2015-17 / GHSA-pg2w-x9wp-vw92","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T21:14:28.383Z","repository_id":25254172,"created_at":"2025-08-17T21:14:28.383Z","updated_at":"2025-08-17T21:14:28.383Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34231214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"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":"2026-06-12T05:31:14.061Z","updated_at":"2026-06-12T05:31:14.770Z","avatar_url":"https://github.com/consbio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# restle 0.5.1\n\n[![Build Status](https://travis-ci.org/consbio/restle.png?branch=main)](https://travis-ci.org/consbio/restle)\n[![Coverage Status](https://coveralls.io/repos/github/consbio/restle/badge.svg?branch=main)](https://coveralls.io/github/consbio/restle?branch=main)\n\nRestle (pronounced like \"wrestle\") helps you create client interfaces for REST resources. If you've used the Django\nORM or other relation mappers, the syntax should look familiar.\n\n```python\nfrom restle.resources import Resource\nfrom restle import fields\n\n\nclass SomeClient(Resource):\n    version = fields.TextField()\n    name = fields.TextField()\n    description = fields.TextField(required=False)\n\n\nc = SomeClient.get('http://example.com/some-resource')\nprint(c.version)\nprint(c.name)\nprint(c.description)\n```\n\n# Install\n\n```bash\n$ pip install restle\n```\n\n# Resources\n\nThe `Resource` class in restle performs the same function for web APIs as the `Model` class in Django does for\ndatabases (this is just an example; Django isn't required to use restle). It simplifies the task of mapping API\nresponses to Python objects.\n\nFor example, suppose you have an API with responds to `GET` requests with the following.\n\n```json\nGET /api/messages/2389/\n\n{\n  \"id\": 2389,\n  \"sender\": \"Pi Pyson\",\n  \"message\": \"Hello!\",\n  \"read\": false\n}\n```\n\nIn this case, the API has four fields: one integer, two text, and one boolean. The corresponding restle resource would\nbe.\n\n```python\nfrom restle.resources import Resource\nfrom restle import fields\n\nclass MessageClient(Resource):\n    id = fields.IntegerField()\n    sender = fields.TextField()\n    message = fields.TextField()\n    read = fields.BooleanField()\n```\n\nNow that you have a resource, you can create start interacting with your web API.\n\n```python\n\u003e\u003e\u003e c = MessageClient.get('http://example.com/api/messages/2389/')\n\u003e\u003e\u003e c.id\n2389\n\u003e\u003e\u003e c.sender\n'Pi Pyson'\n\u003e\u003e\u003e c.message\n'Hello!'\n\u003e\u003e\u003e c.read\nFalse\n```\n\n# Object lists and related resources\n\nOkay, so retrieving a single message is great, but your API probably has a list view as well.\n\n```json\nGET /api/messages/\n\n{\n  \"objects\": [2389, 2374, 2489]\n}\n```\n\nIn this case, the list view just provides the ids. If you want the full messages, you'll need to make additional\nrequests for each message. You can use a `ToManyField` and restle will handle the rest for you.\n\n```python\nclass MessageListClient(Resource):\n    objects = fields.ToManyField(MessageClient, 'id', relative_path='{id}/'\n```\n\nThe first argument to the `ToManyField` specifies the related resource class, the second argument tells restle that\nthe resource only returns a list of object *ids*, not the objects themselves, and the `relative_path` argument\ntells restle how to construct paths to the related resources. Now you can consume from the list view.\n\n```python\n\u003e\u003e\u003e c = MessageListClient.get('http://example.com/api/messages/')\n\u003e\u003e\u003e len(c.objects)\n3\n\u003e\u003e\u003e c.objects[0].message\n'Hello!'\n```\n\nAlternatively, maybe the messages list view returns all the object data inline.\n\n```json\nGET /api/messages/\n\n{\n  \"objects\": [\n    {\n      \"id\": 2389,\n      \"sender\": \"Pi Pyson\",\n      \"message\": \"Hello!\",\n      \"read\": false\n    },\n    {\n      \"id\": 2374,\n      ...\n    },\n    {\n      \"id\": 2489,\n      ...\n    }\n  ]\n}\n```\n\nIn this case, you only need to update your `ToManyField` definition to expect \"full\" objects.\n\n```python\nclass MessageListClient(Resource):\n    objects = fields.ToManyField(MessageClient, 'full')\n```\n\nThe usage is exactly the same as for the id-only example. The last possible variation is partial objects:\n\n```json\nGET /api/messages/\n\n{\n  \"objects\": [\n    {\n      \"id\": 2389,\n      \"read\": false\n    },\n    {\n      \"id\": 2374,\n      \"read\": false\n    }\n    {\n      \"id\": 2489,\n      \"read\": true\n    }\n  ]\n}\n```\n\nIn this case, the `ToManyField` definition should be updated to expect \"partial\" objects, and it will need to be\ntold which field contains the id value.\n\n```python\nclass MessageListClient(Resource):\n    objects = fields.ToManyField(MessageClient, 'partial', id_field='id', relative_path='{id}/')\n```\n\n# Fuzzy key matching\n\nLet's say you want your resource to use PEP8-compliant names, but the API provides you with camel case or some other\nformat. One solution to this is to pass in the `name` parameter for every field definition.\n\n```python\n    class SomeResource(Resource):\n        some_field = fields.TextField(name='someField')\n```\n\nBut you'd need to do that for every field name comprised of more than one word. An easier method is to use the\n`match_fuzzy_keys` option for the resource. This will convert both your field names and the keys from the API\nto lower case and strip all non-alphanumeric characters before attempting to match them. This means you can take an\nAPI output using the `capWords` convention:\n\n```json\nGET /api/some-resource/123/\n\n{\n    \"ID\": 123,\n    \"someField\": \"Some value\",\n    \"someruntogetherfield\": \"No spaces!\",\n    \"cRaZy-FoRmAt\": \"It's crazy!\"\n}\n```\n\nAnd use the standard `snake_case` convention for your resource field names.\n\n```python\nclass SomeResource(Resource):\n    id = fields.IntegerField()\n    some_field = fields.TextField()\n    some_run_together_field = fields.TextField()\n    crazy_format = fields.TextField()\n\n    class Meta:\n        match_fuzzy_keys = True\n```\n\n```python\n\u003e\u003e\u003e c = SomeResource.get('http://example.com/api/some-resource/123/')\n\u003e\u003e\u003e c.id\n123\n\u003e\u003e\u003e c.some_field\n'Some value'\n\u003e\u003e\u003e c.some_run_together_field\n'No spaces!'\n\u003e\u003e\u003e c.crazy_format\n\"It's crazy!\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsbio%2Frestle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsbio%2Frestle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsbio%2Frestle/lists"}