Python Requests: .pem -> .crt + key

前端 未结 2 1302
借酒劲吻你
借酒劲吻你 2020-12-18 03:35

I\'ve been given a .pem file for authentication on an XML POST API. I would prefer using Python Requests and have found in the documentation that I need to convert the .pem

2条回答
  •  伪装坚强ぢ
    2020-12-18 03:47

    There's a behaviour of requests (see documentation here) that you can take advantage of here without having to generate a crt or key files.

    Let's say you have the pem file here: /path/to/certificate.pem, you can then do:

    r = requests.get('https://example.com', verify='/path/to/cetificate.pem')
    

    And it should work perfectly.

提交回复
热议问题