Convert search parameters from the Trove web interface into a form the API understands.
Project description
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.
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')
{'q': 'wragge',
'zone': 'newspaper',
'l-state': ['Queensland'],
'l-category': ['Article'],
'l-illustrated': 'true',
'l-illtype': ['Cartoon']}
See the documentation 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 (@wragge) for the GLAM Workbench.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for trove_query_parser-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28cfc7962c983a51b4e39d17ec8915b68cef4d5dfb4c8dab8803d76bee10d386 |
|
MD5 | 81572de79951a9a941e65abedc7c6c4c |
|
BLAKE2b-256 | 4f94a3d38dd21a810816f7666b85f44cfa1c382e7f93e84679f210e745ab9dea |