Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wragge/trove_query_parser
https://github.com/wragge/trove_query_parser
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/wragge/trove_query_parser
- Owner: wragge
- License: mit
- Created: 2021-06-12T05:07:02.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-29T06:22:39.000Z (over 1 year ago)
- Last Synced: 2024-12-14T00:27:18.208Z (about 1 month ago)
- Language: Jupyter Notebook
- Size: 87.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# 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` functionThe 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_queryparse_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/).