projecthorus / sondehub-infra

GNU General Public License v3.0
26 stars 4 forks source link

running `curl` command indicated by Swagger does not decode properly #104

Closed zacharyburnett closed 1 year ago

zacharyburnett commented 1 year ago

I apologize if this is a simple question; I'm not too familiar with this kind of thing.

running an example curl command indicated by the Swagger page:

curl -X 'GET' 'https://api.v2.sondehub.org/amateur/telemetry?duration=3h&payload_callsign=N1YIP-11' -H 'accept: application/json' -o test.json

results in the following bytes:

\x1f\x8b\x08\0Q\xc5gd\x02\xff\xdd\xd9[o\xdb6\x14\0\xe0\xbf\x12{\xe8Kg\xd3<<\xbc\x06\xc8\0\x03\xf5\xba4k\x9a&\xdb\x8ae\x18\x02-\xd1Z\x03N\x9c\xdaN\x85,\xc8\x7f\xef!e\xd9\x96d-\x17\x1a\xc5\xbc\x17>\x88\xb4\x8ey\xf8\x997\xdf\xb5\x0f\xe1\xf7\xfd\xa3.@{w\xe7\xae-\xb8\xc0.W]p\xbf\x80\xdaUb\x17\x14\xe3\x9c\x9f\x86\xca\xe9\xf8\xefY\x96L\xd2\xb3\xab\xe42\xa5'\xed\x93\xf1\xd5E\xfa\xd3\xcd_;\xfd\xa3\xe3\x93\xee\xfe\xc9\xce\xebd\x96f\xc9m\xbb\xb3\xb3l\xfc%\x9dL\x87\xe3+\xdf\xde\xbf\x9dq\xc9@\xfb\x167\xd7\xa3qr\x91N\xce\xce\x93\xd1h:\xfc\x18\x9a\xfc6p\xef\x7f\x1et\x81\xfb\x16\xd7\xc9\xec\xd3\xfc\xe1\x8fG\xaf\xbb\xa2\xf3a\xff\xd5@\xbc\xec|\xee\x1fwJ\rg\xc3\xcb\xf4l\x92\x9e\xa7\xc3/\xe9E\x11\xa9\xdc\x0f\xcb\xb4\x13\xca\xa8\xd3\xfc\xc5\xb7>v)\xf2\"\x0fT\x7fA\xfd\xf0\xef\\\xff\xaa\x90\x92\x90\x15j:Jf\xd4JJ\xe6\0\xb4\xb4\xa8B)\xb5\xaf\n\xbd\xeej\xc3\xac\xe2Bq\x07\x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\xa0\x90\x8e\xb24\x13\x9e\x9a\xa0\xb0\x12+Ra%\x0b\xf5\xdeo\x80!\xfe\x1fn\xbe\xf3~8F\xbfN\0\x17\xcb\xb2\xf9ZQ\x826\x1c\x85\xf3eey\x96\xba\xb8S\xa3r\xa1\x12\x84\x14L\xd3H\x15\x9b\xc5\xda\xd1\x85Z\xe0\xfcXk\"n\xbe5\x9f_4j:\xbc\xe4T\xfd\x95#Q\x15\x9ej\xb8\xf9\xe6\xb4\x97&\xaa\xdfIO\xb5\x1a7\x92j93\xf5\x8cl\xe2\xe2\x9b\x86F\xfe\x07&M\x18\xbc\xed\xd3D\xb12\x10\x8f\x9e;e\xf8{\x06\xe9\xb0'b\x916_6J\xb3\xdc?U\xe7Nt6\x1f#_.\x94Za\x19\xed\xb0j6\xa9-s\x0f\xcf\x9c\r\t\t*e\xa1\xd2\xaaBe\xb8\xfe\x06\xaf2\x1c\xae\xb90@\x87\xeb\x17a\x19\xafD\x8cEY\xceD=\x03O\x9e?\xef\xef\xbf\x02\xd1\xd4\x12\xf0H\x1c\0\0

Upon visiting the URL, my browser decodes the JSON output correctly; however, I am unable to decode this programmatically. What encoding are these in? Is this compressed?

zacharyburnett commented 1 year ago

ah never mind, I pored through the response header again and noticed content-encoding: gzip; I just needed to enable the gzip feature for reqwest in my Cargo.toml and it worked 😅

darksidelemm commented 1 year ago

Yep, all responses are compressed to save us bandwidth!

What are you trying to grab? If you're going to be regularly getting data, please use websockets (e.g. using pysondehub ) to get the data 'live' rather than having to poll regularly.