Metadata-Version: 2.3
Name: acdh-wikidata-pyutils
Version: 3.0
Summary: Python package to fetch data from Wikidata
Keywords: Wikidata,api client
Author: Peter Andorfer
Author-email: Peter Andorfer <peter.andorfer@oeaw.ac.at>
License: MIT License
         
         Copyright (c) 2023 Austrian Centre for Digital Humanities & Cultural Heritage
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Requires-Dist: acdh-arche-assets>=3.25.0
Requires-Dist: requests>=2.32.5
Requires-Dist: typing-extensions>=4.15.0
Requires-Dist: wikidata>=0.8.1
Requires-Python: >=3.10
Project-URL: Repository, https://github.com/acdh-oeaw/acdh-wikidata-pyutils
Description-Content-Type: text/markdown

[![flake8 Lint](https://github.com/acdh-oeaw/acdh-wikidata-pyutils/actions/workflows/lint.yml/badge.svg)](https://github.com/acdh-oeaw/acdh-wikidata-pyutils/actions/workflows/lint.yml)
[![Test](https://github.com/acdh-oeaw/acdh-wikidata-pyutils/actions/workflows/test.yml/badge.svg)](https://github.com/acdh-oeaw/acdh-wikidata-pyutils/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/acdh-oeaw/acdh-wikidata-pyutils/graph/badge.svg?token=5ZWMXlmFmr)](https://codecov.io/gh/acdh-oeaw/acdh-wikidata-pyutils)
[![PyPI version](https://badge.fury.io/py/acdh-wikidata-pyutils.svg)](https://badge.fury.io/py/acdh-wikidata-pyutils)
[![Build the docs](https://github.com/acdh-oeaw/acdh-wikidata-pyutils/actions/workflows/docs.yml/badge.svg)](https://acdh-oeaw.github.io/acdh-wikidata-pyutils/)

# acdh-wikidata-pyutils
Utility package to fetch data from Wikidata

## install

```shell
pip install acdh-wikidata-pyutils
```

## usage

```python
from acdh_wikidata_pyutils import WikiDataPerson

item = WikiDataPerson("https://www.wikidata.org/wiki/Q44331")
person = item.get_apis_entity()
print(person)
>>> {'name': 'Schnitzler', 'first_name': 'Arthur', 'start_date_written': '1862-05-15', 'end_date_written': '1931-10-21', 'gender': 'male'}
```

```python
from acdh_wikidata_pyutils import WikiDataPlace

item = WikiDataPlace("https://www.wikidata.org/wiki/Q41329")
place = item.get_apis_entity()
print(place)
>>> {'name': 'Linz', 'lat': 48.30583333333333, 'long': 14.286388888888888}
```


```python
from acdh_wikidata_pyutils import fetch_image 
wiki_id = "Q2390830"
item = fetch_image(wiki_id)
print(item)
>>> "https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Theo._Komisarjevsky_LCCN2014715267.jpg/250px-Theo._Komisarjevsky_LCCN2014715267.jpg"
```