Metadata-Version: 2.1
Name: stockholm-library
Version: 0.2.0
Summary: Unofficial SDK for interacting with Stockholm Library.
Home-page: https://github.com/vonNiklasson/stockholm-library-client
Author: Johan Niklasson
Author-email: johan@niklasson.me
License: MIT
Project-URL: Source, https://github.com/vonNiklasson/stockholm-library-client
Project-URL: Bug Reports, https://github.com/vonNiklasson/stockholm-library-client/issues
Keywords: Stockholm Library API
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development
Classifier: Topic :: Office/Business :: Financial :: Accounting
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests[security] (<3,>=2)
Requires-Dist: beautifulsoup4 (<5,>=4)

# Stockholm-Library

[![License][license_img]][license_target]
[![Latest PyPI version][pypi_version_img]][pypi_version_target]
[![PyPI status][pypi_status_img]][pypi_status_target]


[license_target]: https://raw.githubusercontent.com/vonNiklasson/stockholm-library/develop/LICENSE
[license_img]: https://img.shields.io/pypi/l/stockholm-library.svg

[pypi_version_target]: https://pypi.python.org/pypi/stockholm-library/
[pypi_version_img]: https://img.shields.io/pypi/v/stockholm-library.svg

[pypi_status_target]: https://pypi.python.org/pypi/stockholm-library/
[pypi_status_img]: https://img.shields.io/pypi/status/stockholm-library.svg

Unofficial SDK for interacting with [Stockholm Library](https://biblioteket.stockholm.se)

> Currently the project is in very early development and very little 
> functionality can be used. But if you are eager to get stuff going, 
> please consider helping out by [contributing](#contributing)!


## Usage

### Connecting

The simplest way to connect with the client is through credentials.

```python
from stockholm_library import Client

client = Client()
success: bool = client.login(
    user="8705061234",
    pin="1234"
)
print(success)  # True
```

### Fetching loaned books

```python

loans = client.get_loans()

for loan in loans:
    print(loan)  # {id: 123456, book: ...}
```

Below is the structure of a `Loan` object:

```python
{
    "id": 123456,
    "book": models.Book(
        "id": 129716,
        "title": "Liftarens guide till galaxen",
        "author": "Douglas Adams"
    ),
    "borrowed_from": "Telefonplans bibliotek",
    "borrowed_date": datetime.date(2022, 3, 5),
    "due_date": datetime.date(2022, 4, 3),
    "can_re_borrow": True
}
```

Beware that not all loans have an ID at every given moment. If it's not possible to re-borrow a book it won't yield an ID.

  
## Contributing

Contributions are always welcome!

To contribute, please take the following steps:

1. [Fork](https://github.com/vonNiklasson/stockholm-library/fork) the repo
2. Add your change
3. Make a pull request with a short description of the change you're proposing.


## Authors

- [@vonNiklasson](https://www.github.com/vonNiklasson)

  

