Oref
Oref – Python interface to Israel’s Home Front Command (Pikud HaOref) emergrncy alert network.
Installation
pip install oref
Python 3.11 + required.
Quick‑start
import oref
from oref.types import Alert
# Load baseline (English) metadata
oref.init()
# Optional – preload extra languages
oref.init(extra_languages=["he", "ar", "ru"])
# One‑off check (all areas)
alert = oref.check_alert()
if alert:
print(alert)
# Continuous listener (filter to specific areas if desired)
def on_alert(a: Alert):
print("\n>>> INCOMING:", a)
oref.listen(on_alert, areas=["Jerusalem", 158])
API Synopsis
Initialise
| Function | Signature | Purpose |
|---|---|---|
init |
init(extra_languages: List[Literal["ar", "he", "ru"]] = []) |
Downloads location, guideline & translation datasets. Must be called before any other helper. |
Alerts
Alert functions can be invoked from both oref and oref.alerts.
| Function | Signature | Notes | ||
|---|---|---|---|---|
check_alert |
`check_alert(areas: List[str | int] | Literal["all"] = "all") -> Alert \ bool` | Returns latest alert object or False if none. |
||
listen |
`listen(callback: Callable, areas: List[str | int] | Literal["all"] = "all", args=(), kwargs={})` | Polls every second; invokes callback once per unique alert (15‑minute deduplication window). |
Data Helpers
Data helpers can be invoked from both oref and oref.loader
| Function | Returns | Description | |
|---|---|---|---|
locations |
List[Location] |
All known locations with multilingual labels & shelter times. | |
location |
`Location | bool` | Single lookup by ID or any language label. | |
guidelines |
List[Guideline] |
Civil‑defence instructions per alert zone. | |
alert_translations |
List[AlertTranslation] |
Full mapping of alert categories/titles/desc in four languages. | |
translate |
(title, desc) |
Convenience wrapper translating an Alert into the requested language. |
Data Structures (oref.types)
Alert–id,category,title,description,locations,unfiltered_locations;filter_locations(relevant)Location–id,area_id,name(Placename),region(Placename),shelter_timeGuideline–code,area_id,zone_name,label(Placename),time_notes,mode,color_codePlacename– multilingual string container (en / he / ar / ru)AlertTranslation– four‑language mapping plus category metadata
Example – Translate & Filter
from oref import check_alert, translate
alert = check_alert()
if alert:
# Limit to Be’er Sheva & area‑id 165
alert.filter_locations(["Be'er Sheva", 165])
# Convert title/description to Russian
title_ru, desc_ru = translate(alert, "ru")
print(title_ru, "::", desc_ru)
Configuration
oref.config exposes endpoint constants (ALERTS_URL, LOCATIONS_URL, GUIDELINES_URL, ALERT_TRANSLATIONS_URL). Override them before calling init() to point at mirrors, proxies, or test fixtures.
Logging
The package emits informative messages via the standard logging module. Example:
import logging, oref
logging.basicConfig(level=logging.INFO)
oref.init()
Caveats
- Unofficial – not endorsed by Pikud HaOref.
- Upstream JSON schemas may change without notice.
- Network polling every second like the official website; adjust in fork if lower bandwidth is essential.
Licence
MIT © 2025
Metadata
Release files for oref 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oref-0.2.0.tar.gz | 10.1 kB | Without provenance | Details for oref-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oref-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for oref-0.2.0-py3-none-any.whl |
Total release size: 19.1 kB
Release files / oref-0.2.0.tar.gz
| Download URL | oref-0.2.0.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ece9022935f6f66e54b94bdd3c9f9b24c4db48f6a84a05a3ce51ceeeb35ae6b
|
|
BLAKE2b-256 checksum How to use checksums |
2837f5b2899867c5eb7da716796cc4d8ae799b8c2ffbae9be9985d2267280e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / oref-0.2.0-py3-none-any.whl
| Download URL | oref-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bceee8e3f8626752c53482ad63f9c2d8c96a91e89049d34acd9fcdbb30549519
|
|
BLAKE2b-256 checksum How to use checksums |
218b815d28f8965bdd60919971c4862fc07219f2378ce389859a624a812e1dc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for oref 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.