Unable to get data using requests.get while it works with curl

42 views Asked by At

Im trying to get response using RESTCONF. When i use CURL as:

curl -X GET -H "Accept: application/yang-data+json" -H "Content-Type: application/yang-data+json" -k https://user:pass@IP/api/data/switch:opm/port={1,2}

I get output perfectly as

"switch:port": { "port-id": 1, "wavelength": "0000.0", "offset": "0.0", "averaging-time": 4 } } { "switch:port": { "port-id": 2, "wavelength": "0000.0", "offset": "0.0", "averaging-time": 0 } }

But when i use requests.get in python as:

url ="""https://IP/api/data/switch:opm/port={1,2}"""
response  = requests.get(url,headers=self.header,auth =(self.username1,self.password1),verify=False)

I get response 404. I tried port=1 and it works fine in python too. Facing issues when i use port={1,2}.

0

There are 0 answers