{"id":18385484,"url":"https://github.com/prexview/prexview-python","last_synced_at":"2025-07-03T08:34:46.817Z","repository":{"id":44446778,"uuid":"86738906","full_name":"prexview/prexview-python","owner":"prexview","description":"Transform your data from XML or JSON to high quality, beautiful and readable documents in PDF, HTML, PNG or JPG.","archived":false,"fork":false,"pushed_at":"2021-01-06T05:05:18.000Z","size":16,"stargazers_count":20,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-29T10:19:35.265Z","etag":null,"topics":["converter","json","json-parser","json-to-html","json-to-pdf","json-to-png","prexview","transform","xml","xml-parser","xml-to-html","xml-to-pdf","xml-to-png"],"latest_commit_sha":null,"homepage":"https://prexview.com","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/prexview.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":"2017-03-30T19:08:07.000Z","updated_at":"2025-05-18T03:38:46.000Z","dependencies_parsed_at":"2022-09-04T19:10:36.545Z","dependency_job_id":null,"html_url":"https://github.com/prexview/prexview-python","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/prexview/prexview-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prexview","download_url":"https://codeload.github.com/prexview/prexview-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262744770,"owners_count":23357476,"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":["converter","json","json-parser","json-to-html","json-to-pdf","json-to-png","prexview","transform","xml","xml-parser","xml-to-html","xml-to-pdf","xml-to-png"],"created_at":"2024-11-06T01:17:46.655Z","updated_at":"2025-07-03T08:34:46.779Z","avatar_url":"https://github.com/prexview.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![PrexView](https://prexview.com/media/extension/promo.png)\n\n[![Status](https://travis-ci.org/prexview/prexview-python.svg?branch=master)](https://travis-ci.org/prexview/prexview-python)\n\nA Python package to use [PrexView][1], a fast, scalable and friendly service for programatic HTML, PDF, PNG or JPG generation using JSON or XML data.\n\n*See [PrexView][1] for more information about the service.*\n\n\n## Installation\n\n#### PyPI - Python Package Index\n\n```\npip install prexview\n```\n\n## Getting started\n\n#### Get your API Key\n\nYou can get an API Key from [PrexView][1]\n\n#### Set up your API Key\n\nIf you can setup enviroment variables\n\n```\nexport PXV_API_KEY=\"YOUR_API_KEY\"\n```\n\nIf you can't setup environment variables, create the PrexView object with your API Key as argument\n\n```python\npxv = PrexView('YOUR_API_KEY')\n```\n\n#### Include the library\n\n##### PyPI installation\n\n```python\nfrom prexview import PrexView\n```\n\n#### Sending an XML\n\nTo send an XML string use ```pxv.sendXML(xml, options)``` method, this method will return a [Response object][3] on success or thrown an error.\n\n##### Example\n\n```python\npxv = PrexView();\n\noptions = dict(template='supported_languages', output='pdf')\n\nxml = '''\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003clanguages\u003e\n  \u003clang code=\"en\"\u003eEnglish\u003c/lang\u003e\n  \u003clang code=\"es\"\u003eEspañol\u003c/lang\u003e\n  \u003clang code=\"fr\"\u003eFrançaise\u003c/lang\u003e\n\u003c/languages\u003e'''\n\nfile = 'test.pdf'\n\ntry:\n  res = pxv.sendXML(xml, options)\n\n  with open(file, 'wb') as f:\n    f.write(res['file'])\n    f.close()\n\n  print 'File created:', file\nexcept Exception as e:\n  print e\n```\n\n#### Sending a JSON\n\nTo send a JSON string or dictionary object use ```pxv.sendJSON(json, options)``` method, this method will return a [Response object][3] on success or thrown an error.\n\n##### Example\n\n```python\npxv = PrexView();\n\noptions = {'template': 'supported_languages', 'output': 'pdf'}\n\njson = {\n  'languages': [\n    {'code': 'en', 'name': 'English'},\n    {'code': 'es', 'name': 'Español'},\n    {'code': 'fr', 'name': 'Française'}\n  ]\n}\n\nfile = 'test.pdf'\n\ntry:\n  res = pxv.sendJSON(json, options)\n\n  with open(file, 'wb') as f:\n    f.write(res['file'])\n    f.close()\n\n  print 'File created:', file\nexcept Exception as e:\n  print e\n```\n\n##### Response object\n\n|Property|Type|Description|\n|--------|:--:|-----------|\n|id|`string`|Transaction ID.|\n|file|`binary`|Document created by the service.|\n|responseTime|`int`|Response time from service.|\n|rateLimit|`int`|Maximum number of calls to the service.|\n|rateLimitReset|`int`|Seconds to reset the rate limit.|\n|rateRemaining|`int`|Number of remaining call to the service.|\n\n##### Options\n\n|Name|Type|Required|Description|\n|----|:--:|:------:|-----------|\n|template|`string`|Yes|Template's name to be used to document creation, you can use [dynamic values][2].|\n|output|`string`|Yes|Type of document that will be created by PrexView service, it must be **html**, **pdf**, **png** or **jpg**.|\n|note|`string`|No|Custom information to be added to the document's metadata, it's limit up to 500 characters and you can use [dynamic values][2].|\n|format|`string`|No|Type of data used to the document creation, it must be **xml** or **json**, this should be inferred from library methods.|\n|templateBackup|`string`|No|Template's name to use to be used if the option **template** is not available in the service.|\n\n##### Dynamic values\n\nIn **template** or **note** options you can use JSON sintax to access data and have dynamic values, for instance having the following JSON data:\n\n```json\n{\n  \"Data\": {\n    \"customer\": \"123\"\n  }\n}\n```\n\nYour **template** or **note** can use any data attribute or text node, for instance:\n\n```\n'invoice-customer-{{Data.customer}}'\n```\n\nThen we will translate that to the following:\n\n```\n'invoice-customer-123'\n```\n\nAnd finally the service will try to find the **template** or **note** ```invoice-customer-123``` in order to transform the data and generate the document.\n\n## License\n\nMIT © [PrexView][1]\n\n[1]: https://prexview.com\n[2]: #dynamic-values\n[3]: #response-object\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprexview%2Fprexview-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprexview%2Fprexview-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprexview%2Fprexview-python/lists"}