An open API service indexing awesome lists of open source software.

https://github.com/inverse/python-premium-bond-checker

Simple premium bond checker library
https://github.com/inverse/python-premium-bond-checker

library premium-bond python

Last synced: 8 months ago
JSON representation

Simple premium bond checker library

Awesome Lists containing this project

README

          

# Premium Bond Checker

![CI](https://github.com/inverse/python-premium-bond-checker/workflows/CI/badge.svg)
[![PyPI version](https://badge.fury.io/py/premium-bond-checker.svg)](https://badge.fury.io/py/premium-bond-checker)
![PyPI downloads](https://img.shields.io/pypi/dm/premium-bond-checker?label=pypi%20downloads)
[![License](https://img.shields.io/github/license/inverse/cert-host-scraper.svg)](LICENSE)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/astral-sh/ruff)
[![codecov](https://codecov.io/github/inverse/python-premium-bond-checker/graph/badge.svg?token=3IM22FJIJM)](https://codecov.io/github/inverse/python-premium-bond-checker)

Simple premium bond checker library that is built against [Nsandi](https://www.nsandi.com/).

## Usage

### Check the next draw date

You can check the next draw date, which is calculated from the first working day of the month.

```python
from premium_bond_checker.client import Client

print(f"Next draw: {Client.next_draw()}")
```

### Check the next draw date revealed by

Results are not always revealed when the results are drawn. It can take upto 3 additional days for this to happen.

```python
from premium_bond_checker.client import Client
print(f"Next draw reveal by: {Client.next_draw_results_reveal_by()}")
```

### Check results

Results can be checked either granular or on all data points.

```python
from premium_bond_checker.client import Client

premium_bond_number = 'your bond number'

client = Client()

# Check if you've won
result = client.check(premium_bond_number)
print(f"Winning: {result.has_won()}")

# More granular breakdown
result_this_month = client.check_this_month(premium_bond_number)
print(f"This Month Winning: {result_this_month.won}")
print(f"This Month Header: {result_this_month.header}")
print(f"This Month Tagline: {result_this_month.tagline}")

result_last_six_months = client.check_last_six_months(premium_bond_number)
print(f"This Month Winning: {result_last_six_months.won}")
print(f"This Month Header: {result_last_six_months.header}")
print(f"This Month Tagline: {result_last_six_months.tagline}")

result_check_unclaimed = client.check_unclaimed(premium_bond_number)
print(f"This Month Winning: {result_check_unclaimed.won}")
print(f"This Month Header: {result_check_unclaimed.header}")
print(f"This Month Tagline: {result_check_unclaimed.tagline}")
```
## License

MIT