patch-requests-certs.py-to-use-the-system-CA-bundle.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. rom fd9ab446d8479360d2c1c8252508d97d58ed3e0e Mon Sep 17 00:00:00 2001
  2. From: Jeremy Cline <jeremy@jcline.org>
  3. Date: Mon, 19 Jun 2017 16:09:02 -0400
  4. Subject: [PATCH] Patch requests/certs.py to use the system CA bundle
  5. Signed-off-by: Jeremy Cline <jeremy@jcline.org>
  6. ---
  7. requests/certs.py | 11 ++++++++++-
  8. setup.py | 1 -
  9. 2 files changed, 10 insertions(+), 2 deletions(-)
  10. diff --git a/requests/certs.py b/requests/certs.py
  11. index d1a378d..7b103ba 100644
  12. --- a/requests/certs.py
  13. +++ b/requests/certs.py
  14. @@ -11,8 +11,17 @@ only one — the one from the certifi package.
  15. If you are packaging Requests, e.g., for a Linux distribution or a managed
  16. environment, you can change the definition of where() to return a separately
  17. packaged CA bundle.
  18. +
  19. +This Fedora-patched package returns "/etc/ssl/certs/ca-certificates.crt" provided
  20. +by the ca-certificates RPM package.
  21. """
  22. -from certifi import where
  23. +try:
  24. + from certifi import where
  25. +except ImportError:
  26. + def where():
  27. + """Return the absolute path to the system CA bundle."""
  28. + return '/etc/ssl/certs/ca-certificates.crt'
  29. +
  30. if __name__ == '__main__':
  31. print(where())
  32. diff --git a/setup.py b/setup.py
  33. index 93a8507..2db9569 100755
  34. --- a/setup.py
  35. +++ b/setup.py
  36. @@ -45,7 +45,6 @@ requires = [
  37. 'chardet>=3.0.2,<3.1.0',
  38. 'idna>=2.5,<2.8',
  39. 'urllib3>=1.21.1,<1.24',
  40. - 'certifi>=2017.4.17'
  41. ]
  42. test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']
  43. --
  44. 2.9.4