Python SSL requests and Let's Encrypt certs

前端 未结 3 2061
生来不讨喜
生来不讨喜 2021-01-04 20:59

I\'m struggling at the moment to get the requests library to perform a simple GET request to a site of mine with a Let\'s Encrypt certificate. All\'s well with

相关标签:
3条回答
  • 2021-01-04 21:36

    For any lost soul that stumbled upon this post while looking for a Windows Fix for this issue.

    Using Chrome:

    1. Open the URL in using HTTPS.
    2. On the address bar click where it says "Secure".
    3. Click on certificate.
    4. Go to the "Certification Path" tab.
    5. Select "Let's Encrypt Authority X3" (Go up one level) then click "View Certificate".
    6. Go to the "Details" tab and click "Export to File".
    7. On the Wizard click next and select "Base-64 encoded X.509 (.CER)", click next again.
    8. Select a folder and name for the file (Remember this directory).
    9. Go to that folder and right click the certificate and click "Install Certificate".
    10. Select Local Machine (Requires Admin Rights), click next.
    11. Select "Automatically select the certificate store..." (Default), click next.
    12. Click Finish.
    13. Run your Python Script again.

    Disclaimer: Using Chrome 67.0.3396.99 with Windows 10 64-Bit.

    0 讨论(0)
  • 2021-01-04 21:37

    Sounds like your CA CERTS on the machine are not up to date or the web server is not configured to server the full certificate chain.

    0 讨论(0)
  • 2021-01-04 21:43

    On OSX you can export all the certs in your keychain access to a .pem file and then point requests to that file: http://movingpackets.net/2015/03/18/telling-openssl-about-your-root-certificates/

    CA_BUNDLE = path_to_your_exported_file.pem
    response = requests.get(user_account_url, verify=CA_BUNDLE)
    
    0 讨论(0)
提交回复
热议问题