Flask request.args.get () возвращает None на веб-странице localhost. Я не могу показать мои данные, отправленные esp8266 на мой локальный сервер. он работает на командной строке и в окне последовательной связи arduino. Это мои коды:
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
void setup () {
Serial.begin(115200);
WiFi.begin("goksel", "My196051");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting..");
}
Serial.println("Connected to WiFi Network");
}
void loop() {
if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
HTTPClient http; //Declare an object of class HTTPClient
http.begin("http://192.168.1.107:8090/data?name=goksel"); //Specify request destination
int httpCode = http.GET(); //Send the request
if (httpCode > 0) { //Check the returning code
String payload = http.getString(); //Get the request response payload
Serial.println(payload); //Print the response payload
}else Serial.println("An error ocurred");
http.end(); //Close connection
}
delay(10000); //Send a request every 10 seconds
}
Это код колбы:
from flask import Flask,render_template,request
import requests
app=Flask(__name__)
@app.route('/')
def index():
pass
@app.route('/data',methods=['GET','POST'])
def veri():
veri=request.args.get('name')
print(veri)
return 'data {}'.format(veri)
if __name__ =="__main__":
app.run(host='0.0.0.0', port= 8090,debug=True)
И это моя проблема (показать на картинке):
https://ibb.co/R42NVJg