{"id":37077780,"url":"https://github.com/xuthus/pyslurpers","last_synced_at":"2026-01-14T09:01:32.130Z","repository":{"id":62583546,"uuid":"162910040","full_name":"xuthus/pyslurpers","owner":"xuthus","description":"Python slurpers for xml, json, properties and so on","archived":false,"fork":false,"pushed_at":"2020-01-13T12:27:07.000Z","size":51,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T12:42:59.687Z","etag":null,"topics":["config","json","python","python-slurpers","slurper","xml"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xuthus.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":"2018-12-23T17:15:15.000Z","updated_at":"2022-08-18T08:31:44.000Z","dependencies_parsed_at":"2022-11-03T21:49:11.770Z","dependency_job_id":null,"html_url":"https://github.com/xuthus/pyslurpers","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xuthus/pyslurpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuthus%2Fpyslurpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuthus%2Fpyslurpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuthus%2Fpyslurpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuthus%2Fpyslurpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuthus","download_url":"https://codeload.github.com/xuthus/pyslurpers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuthus%2Fpyslurpers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"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":["config","json","python","python-slurpers","slurper","xml"],"created_at":"2026-01-14T09:01:31.460Z","updated_at":"2026-01-14T09:01:32.123Z","avatar_url":"https://github.com/xuthus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Python slurpers for XML, JSON, configs (or .ini) and so on\n\n\u003e Inspired by Groovy's XmlSlurper\n\nSlurper is a object that encapsulates access to structured document file using its dynamic fields as file tags.\n\n### Installation\n\n```bash\npip install pyslurpers\n```\n\n### JSON example:\n\nJson document:\n\n```json\n{\n\t\"name\": \"Joan\",\n\t\"surname\": \"Baez\",\n\t\"born\": 1941,\n\t\"albums\": [\n\t\t{\n\t\t\t\"name\": \"Folksingers 'Round Harvard Square\",\n\t\t\t\"year\": 1959,\n\t\t\t\"number-of-tracks\": 18\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Joan Baez\",\n\t\t\t\"year\": 1960,\n\t\t\t\"number-of-tracks\": 16\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Joan Baez, Vol. 2\",\n\t\t\t\"year\": 1961,\n\t\t\t\"number-of-tracks\": 17\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Joan Baez/5\",\n\t\t\t\"year\": 1964,\n\t\t\t\"number-of-tracks\": 14\n\t\t},\n\t\t{\n\t\t\t\"name\": \"Farewell, Angelina\",\n\t\t\t\"year\": 1965,\n\t\t\t\"number-of-tracks\": 14\n\t\t}\n\t]\n}\n```\n\ncode:\n\n```python\njson = JsonSlurper.create(file_name = \"testdata/baez.json\", illegal_chars = Constants.STRIP_CAPITALIZE)\nself.assertEqual(\"Joan\", json.name)\nself.assertEqual(\"Baez\", json.surname)\nself.assertEqual(1941, json.born)\nself.assertEqual(5, len(json.albums))\nself.assertEqual(\"Farewell, Angelina\", json.albums[4].name)\nself.assertEqual(14, json.albums[4].numberOfTracks)\n```\n\n### Config example:\n\nSample config file:\n\n```ini\n[Database]\nhost: mysql.google.com\ndatabase: search_index\n\n[Security]\nauth provider: google\n\n# and so on...\n```\n\ncode:\n\n```python\nconfig = ConfigSlurper.create(file_name = \"testdata/google.config\", illegal_chars = Constants.REPLACE_WITH_UNDERSCORES)\nself.assertEqual(\"mysql.google.com\", config.Database.host)\nself.assertEqual(\"google\", config.Security.auth_provider)\n```\n\n### XML example:\n\nXml document (see in `testdata/test1.xml`):\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cbeatles\u003e\n  \u003cman\u003e\n    \u003cname\u003eJohn\u003c/name\u003e\n    \u003cname\u003eWinston\u003c/name\u003e\n    \u003csurname\u003eLennon\u003c/surname\u003e\n    \u003cborn\u003e\n        \u003cplace\u003eLiverpool\u003c/place\u003e\n        \u003cyear\u003e1940\u003c/year\u003e\n    \u003c/born\u003e\n  \u003c/man\u003e\n  \u003cman\u003e\n    \u003cname\u003eJames\u003c/name\u003e\n    \u003cname\u003ePaul\u003c/name\u003e\n    \u003csurname\u003eMcCartney\u003c/surname\u003e\n    \u003cborn\u003e\n        \u003cplace\u003eLiverpool\u003c/place\u003e\n        \u003cyear\u003e1942\u003c/year\u003e\n    \u003c/born\u003e\n  \u003c/man\u003e\n  \u003cman\u003e\n    \u003cname\u003eRingo\u003c/name\u003e\n    \u003csurname\u003eStarr\u003c/surname\u003e\n    \u003cborn\u003e\n        \u003cplace\u003eLiverpool\u003c/place\u003e\n        \u003cyear\u003e1940\u003c/year\u003e\n    \u003c/born\u003e\n  \u003c/man\u003e\n  \u003cman\u003e\n    \u003cname\u003eGeorge\u003c/name\u003e\n    \u003csurname\u003eHarrison\u003c/surname\u003e\n    \u003cborn\u003e\n        \u003cplace\u003eLiverpool\u003c/place\u003e\n        \u003cyear\u003e1943\u003c/year\u003e\n    \u003c/born\u003e\n  \u003c/man\u003e\n\u003c/beatles\u003e\n```\n\nPython code:\n```python\nxml = XmlSlurper.create('testdata/test1.xml')\nfor man in xml.man:\n    print('{} {} born at {} in {}'.format(' '.join(man.name), man.surname, man.born.year, man.born.place))\n```\n\nOutput:\n```\nJohn Winston Lennon born at 1940 in Liverpool\nJames Paul McCartney born at 1942 in Liverpool\nR i n g o Starr born at 1940 in Liverpool\nG e o r g e Harrison born at 1943 in Liverpool\n```\nStarr and Harrison don't have second name, so `man.name` for them is a single string, so `' '.join()` concatenates each char in it.\n\nLennon and McCartney are *doublenamed*, so `man.name` for them is list.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuthus%2Fpyslurpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuthus%2Fpyslurpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuthus%2Fpyslurpers/lists"}