{"id":13658680,"url":"https://github.com/HearthSim/python-hsreplay","last_synced_at":"2025-04-24T11:32:40.797Z","repository":{"id":36825515,"uuid":"41132402","full_name":"HearthSim/python-hsreplay","owner":"HearthSim","description":"Python library for creating and parsing HSReplay XML files","archived":false,"fork":false,"pushed_at":"2024-04-24T23:01:59.000Z","size":812,"stargazers_count":52,"open_issues_count":1,"forks_count":14,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-07T17:53:50.244Z","etag":null,"topics":["hearthstone","hsreplay","python","replays","xml"],"latest_commit_sha":null,"homepage":"https://hearthsim.info/hsreplay/","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/HearthSim.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":"2015-08-21T03:27:23.000Z","updated_at":"2024-12-28T11:40:07.000Z","dependencies_parsed_at":"2024-04-09T17:57:22.536Z","dependency_job_id":"00b3f9b1-15a5-4fb6-ba6c-fb4083748861","html_url":"https://github.com/HearthSim/python-hsreplay","commit_stats":{"total_commits":280,"total_committers":7,"mean_commits":40.0,"dds":"0.20714285714285718","last_synced_commit":"c784bd6b5d98c72ca3ae130385f7a3dd67b690dc"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-hsreplay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-hsreplay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-hsreplay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-hsreplay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HearthSim","download_url":"https://codeload.github.com/HearthSim/python-hsreplay/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250618610,"owners_count":21460122,"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":["hearthstone","hsreplay","python","replays","xml"],"created_at":"2024-08-02T05:01:01.632Z","updated_at":"2025-04-24T11:32:40.516Z","avatar_url":"https://github.com/HearthSim.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# python-hsreplay\n\n[![Build Status](https://travis-ci.com/HearthSim/python-hsreplay.svg?branch=master)](https://travis-ci.com/HearthSim/python-hsreplay)\n[![PyPI](https://img.shields.io/pypi/v/hsreplay.svg)](https://pypi.org/project/hsreplay/)\n\nA python module for HSReplay support.\n\n\u003chttps://hearthsim.info/hsreplay/\u003e\n\n\n## Installation\n\nThe library is available on PyPI. `pip install hsreplay` will install it.\n\nDependencies:\n\n* [`hearthstone`](https://github.com/HearthSim/python-hearthstone)\n* [`hslog`](https://github.com/HearthSim/python-hslog)\n* `lxml` (optional) for faster XML parsing and writing. Will use `xml.etree` if not available.\n* `aniso8601` or `dateutil` for timestamp parsing\n\n\n## Usage\n\nThe main document class is `hsreplay.document.HSReplayDocument`.\nThat class contains all the necessary functionality to import and export HSReplay files.\n\n\n### Reading/Writing HSReplay XML files\n\nThe classmethod `from_xml_file(fp)` takes a file-like object and will return a document.\nIf you already have an `ElementTree` object, you can call the `from_xml(xml)` classmethod instead.\n\nTo export to an HSReplay XML document, the `HSReplayDocument.toxml(pretty=False)` method can be\nused to obtain a UTF8-encoded string containing the document.\n\n\n### Reading directly from a log file\n\nThe library integrates directly with the `python-hearthstone` library to produce `HSReplayDocument`\nobjects directly from a log file or a parser instance.\n\nUse the helper classmethods `from_log_file(fp, processor=\"GameState\", date=None, build=None)` and\n`from_parser(parser, build=None)`, respectively.\n\n\n### Exporting back to a PacketTree\n\nIt is possible to export HSReplayDocument objects back into a PacketTree with the `to_packet_tree()`\nmethod. This therefore allows lossless conversion from a PacketTree, into HSReplayDocument, then\nback into a PacketTree.\n\nThis is especially interesting because of the native functionality in `python-hearthstone` which is\nable to export to a Game tree and allows exploring the game state. By converting HSReplayDocument\nobjects to a PacketTree, it's very easy to follow the replay at a gameplay level, explore the state\nof the various entities and even hook into the exporter in order to programmatically analyze it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHearthSim%2Fpython-hsreplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHearthSim%2Fpython-hsreplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHearthSim%2Fpython-hsreplay/lists"}