python-requests/requests-suse_cert_paths.patch
Sascha Peilicke a77547e14d - Update to 0.13.1:
+ Removal of Requests.async in favor of grequests
  + Allow disabling of cookie persistiance.
  + New implimentation of safe_mode
  + cookies.get now supports default argument
  + Session cookies not saved when Session.request is called with return_response=False
  + Env: no_proxy support.
  + RequestsCookieJar improvements.
  + Various bug fixes.
- Rebased patches

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests?expand=0&rev=21
2012-05-30 09:17:32 +00:00

54 lines
2.1 KiB
Diff

diff -ru a/requests/utils.py b/requests/utils.py
--- a/requests/utils.py 2012-05-30 01:54:25.000000000 +0200
+++ b/requests/utils.py 2012-05-30 11:16:23.939251965 +0200
@@ -13,6 +13,9 @@
import codecs
import os
import re
+import socket
+import ssl
+import _ssl
import zlib
from netrc import netrc, NetrcParseError
@@ -40,13 +43,26 @@
'/etc/ssl/certs/ca-certificates.crt',
# FreeBSD (provided by the ca_root_nss package):
'/usr/local/share/certs/ca-root-nss.crt',
+ # openSUSE (provided by the ca-certificates package), the 'certs' directory is the
+ # preferred way but may not be supported by the SSL module, thus it has 'ca-bundle.pem'
+ # as a fallback (which is generated from pem files in the 'certs' directory):
+ '/etc/ssl/certs',
+ '/etc/ssl/ca-bundle.pem',
]
def get_os_ca_bundle_path():
"""Try to pick an available CA certificate bundle provided by the OS."""
for path in POSSIBLE_CA_BUNDLE_PATHS:
if os.path.exists(path):
- return path
+ if os.path.isdir(path):
+ try:
+ # Current candidate is a directory, check if SSL module supports that
+ _ssl.sslwrap(socket.socket()._sock, False, None, None, ssl.CERT_REQUIRED, ssl.PROTOCOL_SSLv23, path, None)
+ return path
+ except:
+ pass # No support, let's check the next candidate
+ else:
+ return path
return None
# if certifi is installed, use its CA bundle;
diff -ru a/setup.py b/setup.py
--- a/setup.py 2012-05-11 00:09:45.000000000 +0200
+++ b/setup.py 2012-05-30 11:16:32.235252151 +0200
@@ -34,7 +34,7 @@
# On certain supported platforms (e.g., Red Hat / Debian / FreeBSD), Requests can
# use the system CA bundle instead; see `requests.utils` for details.
# If your platform is supported, set `requires` to [] instead:
-requires = ['certifi>=0.0.7']
+requires = []
# chardet is used to optimally guess the encodings of pages that don't declare one.
# At this time, chardet is not a required dependency. However, it's sufficiently