Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
rkalidh
Participant

web-api python

Hi 

Am posting a request in check point using python, but headers having single quote in X-cjkp-sid throws bad requests error. kindly advice how to fix it.

 

def getsession(s):
for k,v in t.items():
if(k=="sid"):
return v
import urllib3
from cpauto.core.sessions import CoreClient
import json
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
import requests
import cpauto
cc=cpauto.CoreClient('admin','xxxx','xxxx',verify=False)
r=cc.login()
#print(r.status_code)
t=r.json()
s=getsession(t)
resource="https://172.25.11.16:443/web_api/show-access-layer"
headers={'Content-Type':'application/json','X-chkp-sid':s}
print(headers)

output:

{'Content-Type': 'application/json', 'X-chkp-sid': '5kyhI0pmQ7taefuK-kCsC6JWG2DrwbQ7hhFjGYoYpEw'}

Validated the same with "Postman" where single quote in x-chkp-sid is not working. 

 

0 Kudos
2 Replies
Martin_Valenta
Advisor

0 Kudos
rkalidh
Participant

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events