Upload to sondehub.org/amateur

150 views
Skip to first unread message

Kevin Walton

unread,
Mar 15, 2024, 7:12:49 AM3/15/24
to UKHAS
Hi

I am trying to upload packets to amateur Sondehub like this:

response = requests.put('https://api.v2.sondehub.org/amateur/telemetry', headers=headers, json=data)

where:

headers = {
      'accept': 'text/plain',
      'Content-Type': 'application/json',
    }

and data = {'dev': True, 'software_name': 'wspr2aprs.py', 'software_version': '100923b', 'uploader_callsign': 'G7PMO', 'time_received': '2024-03-14T20:00:00.000Z', 'payload_callsign': 'N0PPP-591', 'datetime': '2024-03-14T20:00:10.000Z', 'lat': 52.312, 'lon': -0.708, 'alt': 140, 'sats': 1, 'temp': 25, 'batt': 3.0, 'grid': 'IO92PH'}

But I am getting a response code =  500 in return.

Can somone spot my error please as I can't see it...

Cheers
Kev

Mike Sharps

unread,
Mar 15, 2024, 7:33:16 AM3/15/24
to uk...@googlegroups.com
Hi Kev
There is a link somewhere on the sondehub site which lets you upload your data interactively in order to test it i cant remember the link offhand and its a bit obscure but will look later. Alsoif i remember right adding the ‘dev = true’ gives back a 500 code so maybe try removing that . 
Mike


--
You received this message because you are subscribed to the Google Groups "UKHAS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukhas+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ukhas/48fb5399-4664-470f-be1c-c22a7a1b4e7en%40googlegroups.com.

Kevin Walton

unread,
Mar 15, 2024, 8:45:37 AM3/15/24
to UKHAS
Thanks Mike, its not the dev=true thing unfortunataly:

{'software_name': 'wspr2aprs.py', 'software_version': '100923b', 'uploader_callsign': 'G7PMO', 'time_received': '2024-03-15T10:00:00.000Z', 'payload_callsign': 'N0PPP-591', 'datetime': '2024-03-15T10:00:10.000Z', 'lat': 52.312, 'lon': -0.708, 'alt': 140, 'sats': 1, 'temp': 25, 'batt': 3.0, 'grid': 'IO92PH'}
Response code =  500

Sasha Tim

unread,
Mar 15, 2024, 8:59:28 AM3/15/24
to uk...@googlegroups.com
There is a pysondehub interface, if you are interested in using a library! 


73 de VE3SVF

--

Kevin Walton

unread,
Mar 15, 2024, 9:14:39 AM3/15/24
to UKHAS
I also took out sats = 1 (a Wspr protocol anomoly) but that hasn't fixed it, also took our grid = as a non standard key and added modulation of WSPR but no luck yet:

{'software_name': 'wspr2aprs.py', 'software_version': '100923b', 'uploader_callsign': 'G7PMO', 'time_received': '2024-03-15T10:00:00.000Z', 'payload_callsign': 'N0PPP-591', 'datetime': '2024-03-15T10:00:10.000Z', 'lat': 52.312, 'lon': -0.708, 'alt': 140, 'temp': 26, 'batt': 3.0, 'modulation': 'WSPR'}
Response code =  500


Any sugestions welcomed

Cheers
Kev

Mike Sharps

unread,
Mar 15, 2024, 10:52:05 AM3/15/24
to uk...@googlegroups.com
Hi Kev
try putting square brackets around the data e.g.

 [{"software_name": "MJSChase","software_version": "1.0.0","uploader_callsign": "MJSChase01","time_received": "2023-07-15T17:14:52.000000Z","payload_callsign": "FLOPPY445","datetime":"2023-07-15T16:14:51.000000Z","lat": 53.22691,"lon": -2.50659,"alt": 48.000,"frequency": 434.447174,"modulation": "LoRa","uploader_position": [ 53.227, -2.507, 48],"uploader_antenna": "car-roof mag_mount"}]


I think this is what caused me some problems too.



Mike Sharps

unread,
Mar 15, 2024, 11:00:42 AM3/15/24
to uk...@googlegroups.com
Here is the link to the interactive test harness I mentioned. I just tried an upload via this removing the square brackets and it gives a 500 error message

I think it's because you can upload an array of payload readings (demarked by [] in json)
if you upload the listener station info then you don't include the square brackets. The test link has examples of all the various messages which you can experiment with.
Hope this helps
Cheers, Mike

Mike Sharps

unread,
Mar 15, 2024, 11:16:27 AM3/15/24
to uk...@googlegroups.com
I just gave your test data a whirl and it didn't like the single quotes for some reason. I changed to double quotes and it worked
[
{

"software_name": "wspr2aprs.py",
 "software_version": "100923b",
"uploader_callsign": "G7PMO",
"time_received": "20240314T20:00:00.000Z",

 "payload_callsign": "N0PPP-591",
 "datetime": "2024-03-14T20:00:10.000Z",
 "lat": 52.312, "lon": -0.708, "alt": 140.0, "sats": 1, "temp": 25.0, "batt": 3.0, "grid": "IO92PH"
}
]

Could just be some weird character corruption when I copied/pasted your example from this thread.
Mike

Kevin Walton

unread,
Mar 15, 2024, 12:57:44 PM3/15/24
to uk...@googlegroups.com
Fantastic, thanks Mike, will be Sunday before I can test again now, but I think you will have cracked it there.

Cheers
Kev

You received this message because you are subscribed to a topic in the Google Groups "UKHAS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ukhas/wNGpPf9K7H4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ukhas+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ukhas/CACk6KX6Oi-sYRzQcegj79G_etSGBbcKaF96-T%2Bzn7UarT%2BRPgA%40mail.gmail.com.

Mike Sharps

unread,
Mar 15, 2024, 1:39:29 PM3/15/24
to uk...@googlegroups.com
No problem Kev , we are starting to plan a few launches so it gave me a chance to get my head back into the swing of things after a long break 



Mark Jessop

unread,
Mar 15, 2024, 4:13:13 PM3/15/24
to uk...@googlegroups.com
If you're getting a response code 500, then that means there will also be an error message attached to the response (if using python requests, it should be accessible with req.text) which should describe what sondehub is barfing on.

As Sasha mentioned, we do also have a uploader python library, with details here: https://github.com/projecthorus/pysondehub/wiki/SondeHub-Amateur-Uploader-Class-Usage

Cheers,
Mark

Kevin Walton

unread,
Mar 18, 2024, 10:41:58 AM3/18/24
to UKHAS
Thanks All, the square brackets was the issue - it has to be a list of packets (even if only a list of one):

[{'software_name': 'wspr2aprs.py', 'software_version': '100923b', 'uploader_callsign': 'G7PMO', 'time_received': '2024-03-18T10:00:00.000Z', 'payload_callsign': 'N0PPP-591', 'datetime': '2024-03-18T10:00:10.000Z', 'lat': 52.312, 'lon': -0.708, 'alt': 140, 'temp': 25, 'batt': 3.0, 'modulation': 'WSPR'}]
Response code =  200
Response =  ^v^ telm logged

Cheers
Kev
Reply all
Reply to author
Forward
0 new messages