[PDB Tech] pdb, PUT, python, fail - or maybe stupidity...

Stefan Pratter stefan at 20c.com
Tue Jan 28 04:53:06 PST 2020


may need to json encode it yourself before you send it off, don't recall tho

so assuming `data` is your net dict

put(data=json.dumps(data))

The server error means it's having trouble parsing json from the data 
you currently send and failing at the first character it encounters.



On 28/01/2020 14.48, Elmar K. Bins wrote:
> Hi Stefan,
> 
> stefan at 20c.com (Stefan Pratter) wrote:
> 
>> print(r.json())
> 
> Ah, I've been looking for that; now it just tells me...
> {'meta': {'error': 'JSON parse error - Expecting value: line 1 column 1 (char 0)'}}
> 
> 
> Ok, I've now tried putting data=...:
> 
> - Only the changes as a simple <dict>.
> - The entire object (from data[0]) as a simple <dict>.
> - The entire object (from data[0]) as {'data': [ <dict> ] }
> - The entire object (from data[0]) plus empty meta as {'data': [ <dict> ], 'meta': {} }
> 
> I'm always getting the JSON parse error.
> Am I missing a conversion step somewhere?
> 
> json.dumps() looks alright in all cases.
> 
> - Elmar.
> _______________________________________________
> Pdb-tech mailing list
> Pdb-tech at lists.peeringdb.com
> https://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
> 


More information about the Pdb-tech mailing list