# Trove query parser
> Convert a query from the Trove web interface into a set of parameters that can be used with the Trove API.
## Installation
`pip install trove-query-parser`
## How to use
* Construct a search in the Trove 'Newspapers and Gazettes' category.
* Copy the search url.
* Feed the url to the `parse_query` function
The second parameter to `parse_query` is the Trove API version number. The default is `2` for backwards compatibility.
```python
from trove_query_parser.parser import parse_query
parse_query('https://trove.nla.gov.au/search/category/newspapers?keyword=wragge&l-artType=newspapers&l-state=Queensland&l-category=Article&l-illustrationType=Cartoon', 3)
```
{'q': 'wragge',
'l-artType': 'newspapers',
'l-state': ['Queensland'],
'l-category': ['Article'],
'l-illustrated': 'true',
'l-illustrationType': ['Cartoon'],
'category': 'newspaper'}
See the [documentation](https://wragge.github.io/trove_query_parser/) for a more detailed example.
## Limitations
Currently this only works with the 'Newspapers & Gazettes' category. Other categories may be added in time.
----
Created by [Tim Sherratt](https://timsherratt.org) ([@wragge](https://twitter.com/wragge)) for the [GLAM Workbench](https://glam-workbench.net/).
Raw data
{
"_id": null,
"home_page": "https://github.com/wragge/trove_query_parser/tree/master/",
"name": "trove-query-parser",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "Trove",
"author": "Tim Sherratt",
"author_email": "tim@timsherratt.org",
"download_url": "https://files.pythonhosted.org/packages/56/90/75efdc41bea4906cdfbc67787f105b1900fa63b4ac8142dfa35efb373b5f/trove_query_parser-0.2.1.tar.gz",
"platform": null,
"description": "# Trove query parser\n> Convert a query from the Trove web interface into a set of parameters that can be used with the Trove API.\n\n\n## Installation\n\n`pip install trove-query-parser`\n\n## How to use\n\n* Construct a search in the Trove 'Newspapers and Gazettes' category.\n* Copy the search url.\n* Feed the url to the `parse_query` function\n\nThe second parameter to `parse_query` is the Trove API version number. The default is `2` for backwards compatibility.\n\n```python\nfrom trove_query_parser.parser import parse_query\n\nparse_query('https://trove.nla.gov.au/search/category/newspapers?keyword=wragge&l-artType=newspapers&l-state=Queensland&l-category=Article&l-illustrationType=Cartoon', 3)\n```\n\n\n\n\n {'q': 'wragge',\n 'l-artType': 'newspapers',\n 'l-state': ['Queensland'],\n 'l-category': ['Article'],\n 'l-illustrated': 'true',\n 'l-illustrationType': ['Cartoon'],\n 'category': 'newspaper'}\n\n\n\nSee the [documentation](https://wragge.github.io/trove_query_parser/) for a more detailed example.\n\n## Limitations\n\nCurrently this only works with the 'Newspapers & Gazettes' category. Other categories may be added in time.\n\n----\n\nCreated by [Tim Sherratt](https://timsherratt.org) ([@wragge](https://twitter.com/wragge)) for the [GLAM Workbench](https://glam-workbench.net/).\n\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Convert search parameters from the Trove web interface into a form the API understands.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/wragge/trove_query_parser/tree/master/"
},
"split_keywords": [
"trove"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d7d6ed0a5fb8067f3bad1a554ee4f298f4125749f839829ae5acd494003d91e1",
"md5": "fcae2168f2be3708d4e187732b383ba2",
"sha256": "fe28fe35ab58ccf90cb6471bace67ea9502f23a99cde83d6739449f023f34997"
},
"downloads": -1,
"filename": "trove_query_parser-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fcae2168f2be3708d4e187732b383ba2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5275,
"upload_time": "2023-08-29T06:20:42",
"upload_time_iso_8601": "2023-08-29T06:20:42.980891Z",
"url": "https://files.pythonhosted.org/packages/d7/d6/ed0a5fb8067f3bad1a554ee4f298f4125749f839829ae5acd494003d91e1/trove_query_parser-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "569075efdc41bea4906cdfbc67787f105b1900fa63b4ac8142dfa35efb373b5f",
"md5": "6b26a1017eb2dd86cdcf1cf1d398fd7e",
"sha256": "9ebbc2d8946a9c9218f5c3a74239ea326c3e13117d8f5f59a7927ce877c35028"
},
"downloads": -1,
"filename": "trove_query_parser-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "6b26a1017eb2dd86cdcf1cf1d398fd7e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7554,
"upload_time": "2023-08-29T06:20:44",
"upload_time_iso_8601": "2023-08-29T06:20:44.683910Z",
"url": "https://files.pythonhosted.org/packages/56/90/75efdc41bea4906cdfbc67787f105b1900fa63b4ac8142dfa35efb373b5f/trove_query_parser-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-29 06:20:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wragge",
"github_project": "trove_query_parser",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "trove-query-parser"
}