No data in GET requests

Inquiry and support for Freematics products
Post Reply
fattylewis
Posts: 2
Joined: Wed Apr 14, 2021 5:20 am

No data in GET requests

Post by fattylewis »

Hey,

Recently got a one+ Model H and have been struggling with a couple of things.

Firstly, im failing to get telelogger to compile when setting net_device to net_wifi. It always fails with:

Code: Select all

teleclient.cpp:393:16: error: expression cannot be used as a function
   if (net.code() == 200) {
                ^
exit status 1
expression cannot be used as a function```
Which i have also raised here: https://github.com/stanleyhuangyc/Freematics/issues/134

To get aorund this i have just been commenting out the 'if' and compiling, this at least allows me to POST data via wifi.
But i'd like to get GET requests working as well, im not sure if this issue is whats causing GET requests to fail as its in the GET code block. (so its probably the my commenting out has caused this).

When the one+ makes a GET request to my server which is just listening for everything, all i get is the device id, nothing else.

Some pointers would be really helpful! (im very much a rookie arduino person).

stanley
Site Admin
Posts: 842
Joined: Sat Mar 01, 2014 3:15 am

Re: No data in GET requests

Post by stanley »

Fixed.

fattylewis
Posts: 2
Joined: Wed Apr 14, 2021 5:20 am

Re: No data in GET requests

Post by fattylewis »

Awesome, will test tonight. Thanks Stanley!

fattylewis
Posts: 2
Joined: Wed Apr 14, 2021 5:20 am

Re: No data in GET requests

Post by fattylewis »

Hey Stanley,

That change has got it compiling so thanks for that!

I still cant seem to make GET requests work though.
My server is just a really basic flask app just to log anything coming in:

Code: Select all

@app.route('/api/entry/push', methods=['GET'])
def push():
    print(request.args)
    return Response(status=200)
I can see the request in the logs for the server:

Code: Select all

172.16.69.29 - - [16/Apr/2021 00:43:41] "GET /api/entry/push?id=*mydeviceid* HTTP/1.1" 200 -
Also just to double check ive not messed anything up on the flask app, if i send a GET request through postman, i can see additional arguments:

Code: Select all

192.168.0.245 - - [16/Apr/2021 00:49:17] "GET /api/entry/push?id=AAAAA&0=123 HTTP/1.1" 200 -
and the serial log shows this:

Code: Select all

00:43:40.468 -> [BUF] 246 samples | 1732 bytes | 100%
00:43:41.629 -> No HTTP response
00:43:41.629 -> Timeouts: OBD:3 Network:1223
00:43:41.629 -> Instable connection
00:43:41.728 -> HTTP/1.0 200 OK
00:43:41.728 -> Content-Type: text/html; charset=utf-8
00:43:41.728 -> Content-Length: 0
00:43:41.728 -> Server: Werkzeug/1.0.1 Python/3.8.7
00:43:41.728 -> Date: Thu, 15 Apr 2021 23:43:41 GMT
I dont see why its saying its getting no HTTP Response, when you can see the 200 OK in there?

But i dont get any other arguments come through. Literally just the device id.
Im testing also with one of the mk2 emulators.
Last edited by fattylewis on Fri Apr 16, 2021 10:07 pm, edited 3 times in total.

Post Reply