Skip to content

Commit 06d2cb3

Browse files
committed
readme: LPDB session
1 parent 7070af4 commit 06d2cb3

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
LPDB-python provides Python interfaces for the [Liquipedia Database API](https://liquipedia.net/api) (LPDB API).
44

5+
## LPDB Session
6+
7+
Python wrapper for LPDB session is defined in [session.py](src/lpdb/session.py). The wrapper provides the following
8+
differences from making your own requests:
9+
10+
- Type hints
11+
- Validation of data type names being requested
12+
If an invalid data type is supplied, then the session will raise `ValueError` before attempting to make a request.
13+
- Error / warning handling
14+
If an error is returned by LPDB, then they will be converted to and raised as a Python exception.
15+
- Pre-configured request header, including formatting of your API key in the request header
16+
17+
```python
18+
import lpdb
19+
20+
# These are equivalent
21+
session = lpdb.LpdbSession("your_lpdb_api_key")
22+
session = lpdb.LpdbSession("Apikey your_lpdb_api_key")
23+
```
24+
525
## LPDB Data Types
626

727
Data types in LPDB can be found in <https://liquipedia.net/commons/Help:LiquipediaDB>.

0 commit comments

Comments
 (0)