{"id":19024247,"url":"https://github.com/sanalzio/pygistdb","last_synced_at":"2026-04-16T18:37:58.001Z","repository":{"id":190176031,"uuid":"682084220","full_name":"sanalzio/PyGistDB","owner":"sanalzio","description":"A primitive module enabling the use of your GitHub Gist as a database.","archived":false,"fork":false,"pushed_at":"2023-10-07T15:44:07.000Z","size":50,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T01:28:05.609Z","etag":null,"topics":["database","gist","gists","python","python3"],"latest_commit_sha":null,"homepage":"","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/sanalzio.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,"publiccode":null,"codemeta":null}},"created_at":"2023-08-23T12:03:37.000Z","updated_at":"2024-11-03T14:30:57.000Z","dependencies_parsed_at":"2023-08-23T15:08:46.092Z","dependency_job_id":"3cb1b344-7cba-4c49-9365-c08d0d0f8fca","html_url":"https://github.com/sanalzio/PyGistDB","commit_stats":null,"previous_names":["sanalzio/pygistdb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanalzio%2FPyGistDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanalzio%2FPyGistDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanalzio%2FPyGistDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanalzio%2FPyGistDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanalzio","download_url":"https://codeload.github.com/sanalzio/PyGistDB/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240072063,"owners_count":19743527,"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":["database","gist","gists","python","python3"],"created_at":"2024-11-08T20:35:42.884Z","updated_at":"2026-04-16T18:37:57.967Z","avatar_url":"https://github.com/sanalzio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyGistDB 1.3\r\nA primitive module enabling the use of your GitHub Gist as a database.\r\n\r\n![logo](image.svg)\r\n\r\n# Updates\r\n- **I discovered a file writing issue in the module and fixed it**\r\n- **pygist class name changed to congist**\r\n- **Changed pygistdb.congist usage** [Go!](https://github.com/sanalzio/PyGistDB/blob/main/README.md#import-example)\r\n- Now the module allows data with newline(\\n) characters.\r\n- Added index function to pylist class. [Go!](https://github.com/sanalzio/PyGistDB/blob/main/README.md#Get-variable-index)\r\n- Added lenFile function to pylist class. [Go!](https://github.com/sanalzio/PyGistDB/blob/main/README.md#Get-list-lenght)\r\n- Litle write gist fix.\r\n- Read fix.\r\n- Memory usage optimization.\r\n\r\n# Requirements\r\n- Python 3\r\n- requests\r\n  - `pip install requests`\r\n- os\r\n\r\n# Dictionary\r\n## import example:\r\n```py\r\nimport pygistdb\r\ngist = pygistdb.congist(\"gistfileid\", \"filename\", \"token\")\r\ndb = pygistdb.pydb(gist)\r\n```\r\n\r\n## add data\r\nold file:\r\n```\r\nvar1:123\r\n```\r\ncode:\r\n```py\r\ndb.addData(\"var2\",\"456\")\r\n```\r\nnew file:\r\n```\r\nvar1:123\r\nvar2:456\r\n```\r\n\r\n## get data\r\nfile content:\r\n```\r\nvar1:123\r\nvarTrue:{True}\r\nvarFalse:{False}\r\nvarNone:{None}\r\n```\r\ncode:\r\n```py\r\nprint(db.getData(\"var1\"))\r\nprint(db.getData(\"varTrue\"))\r\nprint(db.getData(\"varFlas\"))\r\nprint(db.getData(\"varNone\"))\r\n```\r\noutput:\r\n```\r\n123\r\nTrue\r\nFlase\r\nNone\r\n```\r\n\r\n## remove data\r\nold file:\r\n```\r\nvar1:123\r\nvar2:456\r\n```\r\ncode:\r\n```py\r\ndb.removeData(\"var2\")\r\n```\r\nnew file:\r\n```\r\nvar1:123\r\n```\r\n\r\n## clear file\r\nold file:\r\n```\r\nvar1:123\r\nvar2:456\r\n```\r\ncode:\r\n```py\r\ndb.clear()\r\n```\r\nnew file:\r\n(empty)\r\n\r\n## backup data\r\ngist content:\r\n```\r\nvar1:123\r\nvar2:456\r\n```\r\ncode:\r\n```py\r\ndb.backUp(\"backup1.db\")\r\n```\r\nbackup1.db file content:\r\n```\r\nvar1:123\r\nvar2:456\r\n```\r\n\r\n## set data\r\nold content:\r\n```\r\nvar1:123\r\nvar2:456\r\n```\r\ncode:\r\n```py\r\ndb.setData(\"var2\", \"789\")\r\n```\r\nnew content:\r\n```\r\nvar1:123\r\nvar2:789\r\n```\r\n\r\n## Retrieve the data in dictionary format\r\ngist content:\r\n```\r\nvar1:123\r\nvar2:789\r\n```\r\ncode:\r\n```py\r\ncontent = db.fileToDICT()\r\nprint(content)\r\n```\r\noutput:\r\n```\r\n{'var1':'123', 'var2':'789'}\r\n```\r\n\r\n## Dictionary to gist\r\ncode:\r\n```py\r\nmydict = {'var':'Hello', 'varint':123}\r\ndb.dictToFile(mydict)\r\n```\r\nnew gist content:\r\n```\r\nvar:Hello\r\nvarint:123\r\n```\r\n\r\n## Control data\r\ngist content:\r\n```\r\nvar:Hello\r\n```\r\ncode:\r\n```\r\nprint(db.control(\"var\"))\r\nprint(db.control(\"varint\"))\r\n```\r\noutput:\r\n```\r\nTrue\r\nFalse\r\n```\r\n\r\n## Get datas\r\ngist content:\r\n```\r\nvar:Hello\r\nvarint:123\r\n```\r\ncode:\r\n```py\r\nprint(db.keys())\r\nprint(db.values())\r\nprint(db.items())\r\n```\r\noutput:\r\n```\r\n(\"var\", \"varint\")\r\n(\"Hello\", \"123\")\r\n((\"var\", \"Hello\"), (\"varint\", \"123\"))\r\n```\r\n\r\n# List\r\n## import example:\r\n```py\r\nimport pygistdb\r\ngist = pygistdb.congist(\"gistfileid\", \"filename\", \"token\")\r\ndb = pygistdb.pylist(gist)\r\n```\r\n\r\n## add data\r\nold file:\r\n```\r\n123\r\n```\r\ncode:\r\n```py\r\ndb.addData(456)\r\n```\r\nnew file:\r\n```\r\n123\r\n456\r\n```\r\n\r\n## get data\r\nfile content:\r\n```\r\n123\r\n{True}\r\n{False}\r\n{None}\r\n```\r\ncode:\r\n```py\r\nprint(db.getData(0))\r\nprint(db.getData(1))\r\nprint(db.getData(2))\r\nprint(db.getData(3))\r\n```\r\noutput:\r\n```\r\n123\r\nTrue\r\nFlase\r\nNone\r\n```\r\n\r\n## remove data\r\nold file:\r\n```\r\n123\r\n456\r\n```\r\ncode:\r\n```py\r\ndb.removeData(1)\r\n```\r\nnew file:\r\n```\r\n123\r\n```\r\n\r\n## clear file\r\nold file:\r\n```\r\n123\r\n456\r\n```\r\ncode:\r\n```py\r\ndb.clear()\r\n```\r\nnew file:\r\n(empty)\r\n\r\n## backup data\r\ngist content:\r\n```\r\n123\r\n456\r\n```\r\ncode:\r\n```py\r\ndb.backUp(\"backup1.db\")\r\n```\r\nbackup1.db file content:\r\n```\r\n123\r\n456\r\n```\r\n\r\n## set data\r\nold content:\r\n```\r\n123\r\n456\r\n```\r\ncode:\r\n```py\r\ndb.setData(1, 789)\r\n```\r\nnew content:\r\n```\r\n123\r\n789\r\n```\r\n\r\n## Retrieve the data in list format\r\ngist content:\r\n```\r\nHello\r\n123\r\n```\r\ncode:\r\n```py\r\ncontent = db.listFile()\r\nprint(content)\r\n```\r\noutput:\r\n```\r\n[\"Hello\", \"123\"]\r\n```\r\n\r\n## List to gist\r\ncode:\r\n```py\r\nmylist = [\"Hello\", \"I'm fine thank you\"]\r\ndb.listToFile(mylist)\r\n```\r\nnew gist content:\r\n```\r\nHello\r\nI'm fine thank you\r\n```\r\n\r\n## Get list lenght\r\ngist content:\r\n```\r\nHello\r\n123\r\n```\r\ncode:\r\n```py\r\nprint(db.lenFile())\r\n```\r\noutput:\r\n```\r\n2\r\n```\r\n\r\n## Get variable index\r\ngist content:\r\n```\r\nHello\r\n123\r\n```\r\ncode:\r\n```py\r\nprint(db.index(\"Hello\"))\r\nprint(db.index(\"Hello, World\"))\r\n```\r\noutput:\r\n```\r\n-1\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanalzio%2Fpygistdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanalzio%2Fpygistdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanalzio%2Fpygistdb/lists"}