betetr readme
This commit is contained in:
parent
8bc645ebf2
commit
15f5935f7e
28
README.md
28
README.md
@ -5,6 +5,34 @@
|
|||||||
- Send details email
|
- Send details email
|
||||||
|
|
||||||
|
|
||||||
|
## Password API
|
||||||
|
|
||||||
|
A Raspberry PI connected to local network can do the job of serving the password
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# copy the files
|
||||||
|
cp password /opt/
|
||||||
|
cp password.service /etc/systemd/system/
|
||||||
|
|
||||||
|
# Install the depentencies
|
||||||
|
apt update
|
||||||
|
apt install python3-pip
|
||||||
|
pip install aiohttp
|
||||||
|
|
||||||
|
# Restart systemd daemon
|
||||||
|
systemctl daemon-reload && systemctl status password
|
||||||
|
systemctl start password && systemctl enable password
|
||||||
|
|
||||||
|
# Test the service
|
||||||
|
curl http://192.168.1.199:9999/andthepasswordis
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
- send mails
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
11
password-api/password.py
Normal file
11
password-api/password.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#! /usr/bin/python3
|
||||||
|
from aiohttp import web
|
||||||
|
|
||||||
|
async def sendpass(request):
|
||||||
|
data = {"password": "12345678"}
|
||||||
|
return web.json_response(data)
|
||||||
|
|
||||||
|
app = web.Application()
|
||||||
|
app.add_routes([web.get('/andthepasswordis', sendpass)])
|
||||||
|
web.run_app(app, port=9999)
|
||||||
|
|
||||||
12
password-api/password.service
Normal file
12
password-api/password.service
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Password ASPI Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
ExecStart=/usr/bin/env python /opt/password.py
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user