{"id":13826086,"url":"https://github.com/weilueluo/pyfallback","last_synced_at":"2026-02-09T03:31:51.487Z","repository":{"id":65287230,"uuid":"589194120","full_name":"weilueluo/pyfallback","owner":"weilueluo","description":"Fallback for python objects","archived":false,"fork":false,"pushed_at":"2023-01-16T21:21:58.000Z","size":42,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-09T02:19:11.652Z","etag":null,"topics":["fallback","python"],"latest_commit_sha":null,"homepage":"https://github.com/weilueluo/pyfallback","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weilueluo.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":"2023-01-15T11:48:21.000Z","updated_at":"2023-01-19T11:20:25.000Z","dependencies_parsed_at":"2023-02-10T06:15:30.330Z","dependency_job_id":null,"html_url":"https://github.com/weilueluo/pyfallback","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/weilueluo/pyfallback","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weilueluo%2Fpyfallback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weilueluo%2Fpyfallback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weilueluo%2Fpyfallback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weilueluo%2Fpyfallback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weilueluo","download_url":"https://codeload.github.com/weilueluo/pyfallback/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weilueluo%2Fpyfallback/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29255602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T03:07:45.136Z","status":"ssl_error","status_checked_at":"2026-02-09T03:07:24.123Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fallback","python"],"created_at":"2024-08-04T09:01:31.909Z","updated_at":"2026-02-09T03:31:51.466Z","avatar_url":"https://github.com/weilueluo.png","language":"Python","readme":"# pyfallback\n\n1. Use `Fallback` to wrap an object with fallback value.\n2. Safely do stuff that possibly go wrong.\n3. Use the `get()` method to retrieve result.\n\n## Install\n\n```bash\npip install pyfallback\n```\n\n## Usage\n\n```python\nfrom pyfallback import Fallback\n\n# fallback\njson = Fallback({\"key\": \"value\"}, fallback=\"fallback\")\njson[\"key\"].get()  # \"value\"\njson[\"bla\"].get()  # \"fallback\"\n\n# chaining\njson = Fallback({\"key\": \"1-2-3\"}, fallback=\"4\")\njson[\"key\"].split(\"-\")[0].get()  # \"1\"\njson[\"bla\"].split(\"-\")[0].get()  # \"4\"\n\n# iterating\njson = Fallback({\"key\": [1, 2, 3]}, fallback=[4, 5, 6])\n[v.get() for v in json[\"key\"]]  # [1, 2, 3]\n[v.get() for v in json[\"bla\"]]  # [4, 5, 6]\n\n# see tests/test_fallback.py for more example \n```\n\n## Contributing\n\nJust submit a pull request :D \u003cbr /\u003e\nNote: this project uses [poetry](https://github.com/python-poetry/poetry) and [pyenv](https://github.com/pyenv/pyenv).\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweilueluo%2Fpyfallback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweilueluo%2Fpyfallback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweilueluo%2Fpyfallback/lists"}