Metadata-Version: 2.4
Name: calmido
Version: 0.1.0
Summary: Client for the Calmido phone number lookup API: who is calling from a Dutch, Belgian or Luxembourgish number, and is it reported as spam.
Project-URL: Homepage, https://www.calmido.com/nl-en/developers
Project-URL: Documentation, https://www.calmido.com/nl-en/developers/reference
Project-URL: Repository, https://github.com/Calmido/phone-number-lookup-api
Project-URL: Changelog, https://github.com/Calmido/phone-number-lookup-api/blob/main/CHANGELOG.md
License-Expression: MIT
Keywords: belgium,benelux,caller-id,lookup,luxembourg,netherlands,phone,spam
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Communications :: Telephony
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# calmido

Python client for the [Calmido phone number lookup API](https://www.calmido.com/nl-en/developers): who is
calling from a Dutch (+31), Belgian (+32) or Luxembourgish (+352) number, and is it reported as spam.
Standard library only, Python 3.9 or later.

```sh
pip install calmido
```

Get a free key at [calmido.com/nl-en/developers](https://www.calmido.com/nl-en/developers) and keep it on
your server.

```python
from calmido import Calmido, CalmidoError

calmido = Calmido()  # the key from CALMIDO_API_KEY, or Calmido("cal_…")

try:
    answer = calmido.lookup("+31 183 554 004")
except CalmidoError as error:
    # error.status, error.code (invalid_number, invalid_key, rate_limited, …), error.retry_after
    raise

print(answer.verdict, answer.report_count)  # suspicious 59
print(answer.summary)                       # one sentence you may quote, with the link
print(answer.page_url)                      # link this wherever you show the verdict
```

`lookup(number, country=None, language="en")` takes international (`+31 20 123 4567`, `0031…`,
`31201234567`) or national (`020 123 4567`, with `country="BE"` for a Belgian one) numbers.
`usage()` gives the key's plan and today's count. `verdict` is one of `suspicious`, `safe`, `neutral`,
`business`, `empty`, `restricted` or `unavailable`: `empty` does not mean a number is safe, and
`unavailable` never means "no reports". The full contract is the
[OpenAPI spec](https://github.com/Calmido/phone-number-lookup-api/blob/main/openapi.yaml).

Errors: a refusal is a `CalmidoError`; a network failure passes through as an `OSError`
(`urllib.error.URLError`, a timeout; the default timeout is 10 seconds, `Calmido(timeout=…)`).

## Using it within the terms

The [API terms](https://github.com/Calmido/phone-number-lookup-api/blob/main/terms/api-terms.md) apply to
every use. The ones a client cannot enforce for you:

- **One number per lookup**, for the numbers your users ask about or are called by. Walking through number
  ranges is extraction.
- **Name Calmido and link `page_url` wherever you show a verdict.** A business name is shown only with its
  `sources`.
- **This client caches nothing.** Keep an answer for at most 24 hours if you cache it yourself, and do not
  build a history from it.
- **Free key: 100 distinct numbers a day**, 60 requests a minute. A repeat of a number already looked up
  today does not count again.

MIT licence. The data the API returns is governed by the API terms.
