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

Mike Simkins mike.simkins at sungardas.com
Tue Jan 28 03:20:16 PST 2020


It is probably just because it is redirecting through proofpoint, which mangles the URL with junk, change your URL to just be 

URL = 'https://api-user.......@peeringdb.com/api/net/12085'



Mike Simkins ▪ Technical Architect ▪ Core Network Architecture and Engineering ▪ Sungard Availability Services
Lighterman House, 3 Clove Crescent, London E14 2BB ▪  Office: +44 (0) 20 8080 8060 / +1 720-833-7731 ▪ Mobile: +44 (0) 7710 677486 ▪ mike.simkins at sungardas.com ▪ www.sungardas.com
Sungard Availability Services Service Desk ▪ (EMEA) +44 (0) 800 279 9166 ▪ (US) +1 800 441 1181

Upcoming Vacation: None Scheduled

Top 5 Strengths: RESPONSIBILITY – ADAPTABILITY – DELIBERATIVE – BELIEF – RESTORATIVE


     
CONFIDENTIALITY:  This e-mail (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited.  If you received this e-mail in error, please notify the sender and delete this e-mail from your system.

-----Original Message-----
From: Pdb-tech <pdb-tech-bounces at lists.peeringdb.com> On Behalf Of Elmar K. Bins
Sent: 28 January 2020 11:05
To: pdb-tech at lists.peeringdb.com
Subject: [PDB Tech] pdb, PUT, python, fail - or maybe stupidity...

Hi gents, ladies,

Arnold asked me to post this to the list, maybe I'm just doing something very wrong. If anybody has a hint (or experience), that could potentially make me happy :-)

Elmar.

===

I'm trying to update a net object from python, using the requests library with the peeringdb RESTful API, essentially doing a PUT operation..

Just in case I'm too stupid to ... here's the whole she-bang

---------- What I send:

import request

URL = 'https://urldefense.proofpoint.com/v2/url?u=https-3A__isc-2Dapiuser-3A-2A-2A-2A-2A-2A-2A-2A-2A-40peeringdb.com_api_net_12085&d=DwIGaQ&c=gYbc-GKV5BQa9zrq1GFCVg&r=S1PZn0PYDDYtiCW2fix2C1ZHo8KzLAckyehxqI4wl20&m=Bj5gpSKHmwyokLiDwTrX0jXf9zpTc2-BOA0tVEB24-I&s=m809anJEvmQAAbe3mQGEhilJNcZnYIdNFC67b1jafjE&e= '

dict_headers = {
        "Accept"       : "application/json",
        "Content-Type" : "application/json",
        }

dict_changes = {
        "irr_as_set"     : "AS3557",
        }

request.put(url=URL, data=dict_changes, headers=dict_headers)


---------- What I get:

400 Client Error: Bad Request for url:
https://urldefense.proofpoint.com/v2/url?u=https-3A__isc-2Dapiuser-3A-2A-2A-2A-2A-2A-2A-2A-2A-2A-2A-2A-2A-40peeringdb.com_api_net_12085&d=DwIGaQ&c=gYbc-GKV5BQa9zrq1GFCVg&r=S1PZn0PYDDYtiCW2fix2C1ZHo8KzLAckyehxqI4wl20&m=Bj5gpSKHmwyokLiDwTrX0jXf9zpTc2-BOA0tVEB24-I&s=Y34j7X3mWgmw72IypQKJtOk-oN-Zwlz-GnIqByXPMbc&e= 

===

Yes, the user has "update" rights to all net objects (got the 403 when that was not the case, so auth works) _______________________________________________
Pdb-tech mailing list
Pdb-tech at lists.peeringdb.com
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.peeringdb.com_cgi-2Dbin_mailman_listinfo_pdb-2Dtech&d=DwIGaQ&c=gYbc-GKV5BQa9zrq1GFCVg&r=S1PZn0PYDDYtiCW2fix2C1ZHo8KzLAckyehxqI4wl20&m=Bj5gpSKHmwyokLiDwTrX0jXf9zpTc2-BOA0tVEB24-I&s=tfVh-g36bth22xWoVlM5hkRtsUONnBwkdN3sMEw5Os8&e= 


More information about the Pdb-tech mailing list