Authentication

########### Python 2.7 ############# import httplib, urllib, base64 headers = { # Request headers 'Content-Type': 'application/x-www-form-urlencoded', 'Ocp-Apim-Subscription-Key': '5f738133cb354f1d8e50d713238fe8e8', } params = urllib.urlencode({ 'grant_type': 'client_credentials', 'client_id': 'CVwkWviKzOkk', 'client_secret': 'SYB6F0KxuJPi', 'scope': 'customer' }) try: conn = httplib.HTTPSConnection('api-staging.booker.com') conn.request("POST", "/v5/auth/connect/token?%s" % params, body="{}", headers=headers) response = conn.getresponse() data = response.read() print(data) conn.close() except Exception as e: print("[Errno {0}] {1}".format(e.errno, e.strerror))

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.