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

Stefan Pratter stefan at 20c.com
Tue Jan 28 04:30:26 PST 2020


 > I don't seem to get more information than "Client Error: Bad 
request"; I'll try
 > and find out if there's more somewhere that will show me why it 
fails, but so
 > far I've not been lucky..

If you're using python requests to handle your requests it'd be the 
json() method on the result returned by the put() call

r = put(..)
print(r.json())

 > Thanks for the insight; I tried submitting the entire object, still 
getting the
 > same response.

grab the net dict as it is from 
https://www.peeringdb.com/api/net/12085?pretty&depth=0

depth 0 is important here so you don't expand relationships - also make 
sure you don't grab the root dict or the data list, just the net dict 
itself.

try sending that with your put request (modify the field you want to modify)

If it's still failing with that it's some other issue and the content of 
the 400 response would be vital :)



On 28/01/2020 14.13, Elmar K. Bins wrote:
> Hi Stefan,
> 
> stefan at 20c.com (Stefan Pratter) wrote:
> 
>> PUT needs you supply values for all required fields not just fields you want
>> to change, i am guessing that's what is the issue here.
> 
> Thanks for the insight; I tried submitting the entire object, still getting the
> same response.
> 
>> If you check the content of the 400 response you are getting it should tell
>> you which other fields it wants you to submit in your payload (or any other
>> reason why it's failing)
> 
> I don't seem to get more information than "Client Error: Bad request"; I'll try
> and find out if there's more somewhere that will show me why it fails, but so
> far I've not been lucky..
> 
> - 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