0

I am just one and half week old in python, so please bear my ignorance-

I am trying to make a POST call with oauth key-

the code I am using-

import requests
import json


url = "https://monkeyman.com/private/bananaintelligence/merchant"

datas = {
   "merchantLookup" : [
       {
          "name": "BananaPi",
          "postcode": "10011",
          "country": "USA"
       }

    ]
}

headers = {'Content-type': 'application/json', 'Authorization':'Bearer hiuqbqjbdyqgf6etyqgeqk!$#$DFWEDWEFWEFERGREGERGRHG$%#T#T#T#T##TERGEGEGEGEGE'}

rsp = requests.post(url, json=datas, headers=headers)

Error -

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

I know that key is fine since it's working fine with my spring boot app and also from postman, is there any specific way in python to pass Authorization key. Help!

Shek
  • 1,543
  • 6
  • 16
  • 34

1 Answers1

0

The ssl certificate failed to be verified. You can just skip ssl verification with verify=False.

rsp = requests.post(url, json=datas, headers=headers, verify=False)

Arount
  • 9,853
  • 1
  • 30
  • 43
  • API I am calling has oauth validation. it's a third party API I pretty sure skipping authorization will not get me desired response. – Shek Jun 28 '17 at 15:27
  • is this helps ? https://stackoverflow.com/questions/15445981/how-do-i-disable-the-security-certificate-check-in-python-requests (i'm not sure..) – Arount Jun 28 '17 at 15:29
  • tried, didn't help -InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://securitybot/advanced-usage.html#ssl-warnings InsecureRequestWarning) – Shek Jun 28 '17 at 15:31
  • but this test made sure that code is ok and trying to make ssl handshakes. thanks – Shek Jun 28 '17 at 15:32
  • is there any specific way in python to pass Authorization key – Shek Jun 28 '17 at 15:33