Clean Up
This commit is contained in:
parent
4e5b6723be
commit
a9f791b72f
2 changed files with 0 additions and 0 deletions
26
assets/notes/FrontToBackend.md
Normal file
26
assets/notes/FrontToBackend.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
To send commands from a Python script to a web server, you can use HTTP requests. The requests library is a popular and user-friendly option for making HTTP calls in Python.
|
||||
For example, you can send a POST request with data to a specific URL:
|
||||
|
||||
import requests
|
||||
|
||||
data = {"key": "value"}
|
||||
response = requests.post("http://example.com/api", data=data)
|
||||
|
||||
Alternatively, you can use the built-in urllib module, though requests is generally preferred for its simplicity and readability.
|
||||
|
||||
For sending data from a Raspberry Pi to a web server, you can use tools like curl in a cron job to periodically send data from a Python script to a server endpoint.
|
||||
For instance:
|
||||
|
||||
curl -X POST -d "$(python /path/to/script.py)" http://example.com/receive.php
|
||||
|
||||
This approach allows the script to output data, which is then sent to the server via HTTP POST.
|
||||
|
||||
If you are building a web server in Python to receive commands, you can use the http.server module to create a simple server that handles incoming requests.
|
||||
For example, a basic server can be started with:
|
||||
|
||||
python3 -m http.server 8000
|
||||
|
||||
This starts a server on port 8000, accessible via http://localhost:8000.
|
||||
You can extend this server to process incoming commands by defining custom request handlers using BaseHTTPRequestHandler.
|
||||
|
||||
For more advanced use cases, frameworks like Flask or Django can be used to create robust web servers capable of handling complex command logic and data processing.
|
||||
21
assets/notes/notes.md
Normal file
21
assets/notes/notes.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Notes
|
||||
## To Do
|
||||
1. [ ] define actions and plan
|
||||
2. [ ] create simple web interface with flask and nginx
|
||||
3. [ ] communicate with Meshtastic device via web interface
|
||||
|
||||
## Follow up
|
||||
### Backend
|
||||
[meshtastic-cli-receive-text](https://github.com/brad28b/meshtastic-cli-receive-text)
|
||||
|
||||
### Web app
|
||||
[flask web app tutorial](https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3)
|
||||
|
||||
[w3schools How to's](https://www.w3schools.com/howto/default.asp)
|
||||
|
||||
## Timeline
|
||||
|
||||
### Backend
|
||||
- Environment setup script in development
|
||||
|
||||
### Frontend
|
||||
Loading…
Add table
Add a link
Reference in a new issue