semvec/pypi-packages huggingface dataset:
ewii 0.2.1
A Python client for EWIIs self-service portal
Requires Python: >=3.7

# ewii-python

Unofficial client for Denmark’s **EWII** self-service portal

Query meters, daily kWh, contracts, and more from Python or expose them through a webserver.

## 📚 Public methods

| Method                                | Description                                                           |
| ------------------------------------- | --------------------------------------------------------------------- |
| `login()`               | Interactive MitID login; copies cookies into your `requests.Session`. |
| `get_consumption(from, to, meter_id)` | Array of daily kWh values.                                              |
| `get_individ_oplysninger()`           | Personal/identity data.                                               |
| `get_aftaler()`                       | Active contracts.                                                     |
| `get_info()`                          | Hidden JSON blob from `/privat` (addresses, meters, etc.).            |
| `_keep_alive()`                       | Lightweight ping to keep cookies fresh.                               |

---

## 📦 Installation

```bash
pip install ewii
playwright install chromium
```

---

## Script example

```python
import json, requests
from datetime import date
from ewii import EwiiClient

client = EwiiClient()
client.login()

info = client.get_info()
meter = info["forbrugssteder"][0]["maalepunkter"][0]["maalepunktId"]

today = date.today(); first = today.replace(day=1)
print(client.get_consumption(first.isoformat(), today.isoformat(), meter))
```

---

## 🌐 Minimal FastAPI webserver
Create a python file called `app.py`
```python
import json, threading, requests
from datetime import date
from fastapi import FastAPI, Query, HTTPException
from ewii import EwiiClient

KEEP_ALIVE_TIMER = 30
stop = threading.Event()
client = EwiiClient(requests.Session())

def keep_alive(evt):
    while not evt.wait(KEEP_ALIVE_TIMER):
        try:
            client._keep_alive()
            print("keep-alive")
        except Exception as e:
            print(e)

app = FastAPI(title="EWII API")

@app.on_event("startup")
def start():
    threading.Thread(target=keep_alive, args=(stop,), daemon=True).start()

@app.on_event("shutdown")
def done():
    stop.set()

@app.get("/consumption")
def consumption(meter_id: str, date_from: date, date_to: date):
    try:
        return client.get_consumption(date_from.isoformat(),
                                      date_to.isoformat(),
                                      meter_id)
    except Exception as e:
        raise HTTPException(502, str(e))

if __name__ == "__main__":
    import uvicorn

    uvicorn.run("app:app", host="127.0.0.1", port=8000, reload=True)
```

Open [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) for interactive Swagger UI. The background thread pings EWII every 5 minutes so the session stays alive.

---


> **Note**  This library is **unofficial** and not affiliated with EWII. Use responsibly and respect EWII’s terms of service.
django-wsgi3 1.0.5
Enhanced WSGI support (for Django 4.2)
Requires Python: >=3.8
Keywords: django, wsgi, webob, web

# django-wsgi3

*django-wsgi3* is a fork of *django-wsgi2* that has been modified to be compatible with Django 4.2.


## Installation

This package can be installed from pip3:
```
pip3 install django-wsgi3
```

## Configuration

In the original [django-wsgi documentation](https://pythonhosted.org/django-wsgi/ "django-wsgi documentation") the configuration is based on modifying the *WSGI_APPLICATION* setting value in settings.py. This is enough for development purposes but does not work in a production environment. In a production environment, it is not clear the location of the WSGI application that the HTTP server has to target requests to. The documentation was vague about this point, so this package provides an alternative:

This is how django-wsgi2 is configured both for testing and production:

In your Django project wsgi.py file (project_root/project_name/wsgi.py), replace this line:
```python
from django.core.wsgi import get_wsgi_application
```
for this:
```pyton
from django_wsgi.handler import get_wsgi_application
```

That is all you need to do.

## Documentation

Additionanl documentation for django-wsgi2 can be found in the original django-wsgi package [documentation](https://pythonhosted.org/django-wsgi/).