{"id":18057290,"url":"https://github.com/m4cs/s1-python","last_synced_at":"2025-07-31T06:07:04.806Z","repository":{"id":96217867,"uuid":"256669032","full_name":"M4cs/s1-python","owner":"M4cs","description":"s1db Python Library for S1: https://github.com/Kognise/S1","archived":false,"fork":false,"pushed_at":"2020-04-18T04:41:37.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T21:13:43.482Z","etag":null,"topics":["jsonstore","objectstore","python","s1","s1db"],"latest_commit_sha":null,"homepage":null,"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/M4cs.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":"2020-04-18T04:25:50.000Z","updated_at":"2020-10-16T01:13:49.000Z","dependencies_parsed_at":"2023-04-22T17:31:15.442Z","dependency_job_id":null,"html_url":"https://github.com/M4cs/s1-python","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/M4cs%2Fs1-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4cs%2Fs1-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4cs%2Fs1-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4cs%2Fs1-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M4cs","download_url":"https://codeload.github.com/M4cs/s1-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247320198,"owners_count":20919732,"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":["jsonstore","objectstore","python","s1","s1db"],"created_at":"2024-10-31T02:07:18.797Z","updated_at":"2025-04-05T10:22:40.352Z","avatar_url":"https://github.com/M4cs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# S1 Python\n\nA barebones key-value store that requires no setup besides a token. This is the Python Library for S1. Find more information [here](https://github.com/Kognise/S1)\n\n## Getting A Token\n\nHead over to [s1.kognise.dev/token](https://s1.kognise.dev/token) to get a token. Don't share this with anyone as it's your key to accessing all your data on your S1 DB. You can store this as an environment variable. \n\n## Installation\n\nFirst, install S1 with `pip`:\n```bash\n$ pip install s1db\n```\n\nThen you can import it like so:\n```python\nfrom s1db import S1\n\n# Replace \"your-token-here\" with the token you got from the URL above.\napi = S1(\"your-token-here\")\n```\n\n## Usage\n\n**Setting Objects as Values:**\n\nTo set a Python object as a value use the `S1.set()` method.\n```python\napi.set('keyname', 123)\napi.set('keyname0', [23])\napi.set('keyname1', {'foo': 'bar'})\n```\n\nThe set method will automatically serialize your data for you into valid JSON to be stored on the S1 DB.\n\n**Getting An Object:**\n\nTo get an object from your S1 DB use the `S1.get()` method.\n\n```python\napi.get('keyname') # Returns: 123 based on the set example from above.\napi.get('keyname0') # Returns: [23] as a list based on the set example from above.\napi.get('keyname1') # Returns: {'foo': 'bar'} as a Python dict based on the set example from above.\n```\n\n**Setting Raw Values:**\n\nTo set a raw string as a value use the `S1.set_raw()` method.\n\n```python\napi.set_raw('keyname-raw', '12')\napi.set_raw('keyname-raw0, '{\"foo\": \"bar\"}')\n```\n\nThe set_raw method does not do any JSON serialization and raw items cannot be returned with the `get()` method.\n\n**Getting Raw Values:**\n\nTo get a raw value from a key use the `S1.get_raw()` method.\n\n```python\napi.get_raw('keyname-raw') # Returns: 12 with no serialization\napi.get_raw('ketname-raw0') # Returns: '{\"foo\": \"bar\"}' as string\n```\n\n**Deleting Keys:**\n\nTo delete data use the `S1.delete()` method.\n\n```python\napi.delete('keyname')\n```\n\n**Getting All Keys:**\n\nTo get all your keys use the `S1.get_keys()` method.\n\n```python\napi.get_keys() # Returns: List of key names as Python object.\n```\n\n## Running Tests:\n\nYou need the `unittest` module from pip:\n```bash\n$ pip install unittest\n```\n\nThen from within the s1-python directory run:\n```bash\n$ python -m unittest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4cs%2Fs1-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm4cs%2Fs1-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4cs%2Fs1-python/lists"}