# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# @author: Sanju Abraham, Juniper Networks, OpenContrail
from requests.adapters import HTTPAdapter
try:
    # This is required for RDO, which installs both python-requests
    # and python-urllib3, but symlinks python-request's internally packaged
    # urllib3 to the site installed one.
    from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
    # Fallback to standard installation methods
    from urllib3.poolmanager import PoolManager

class SSLAdapter(HTTPAdapter):
    '''An HTTPS Transport Adapter that can be configured with SSL/TLS
       version.'''

    def __init__(self, ssl_version=None, **kwargs):
        self.ssl_version = ssl_version
        self.poolmanager = None

        super(SSLAdapter, self).__init__(**kwargs)

    def init_poolmanager(self, connections, maxsize, block=False):
        self.poolmanager = PoolManager(num_pools=connections,
                                       maxsize=maxsize,
                                       block=block,
                                       ssl_version=self.ssl_version)

# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# @author: Sanju Abraham, Juniper Networks, OpenContrail
from requests.adapters import HTTPAdapter
try:
    # This is required for RDO, which installs both python-requests
    # and python-urllib3, but symlinks python-request's internally packaged
    # urllib3 to the site installed one.
    from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
    # Fallback to standard installation methods
    from urllib3.poolmanager import PoolManager

class SSLAdapter(HTTPAdapter):
    '''An HTTPS Transport Adapter that can be configured with SSL/TLS
       version.'''
    HTTPAdapter.__attrs__.extend(['ssl_version'])

    def __init__(self, ssl_version=None, **kwargs):
        self.ssl_version = ssl_version
        self.poolmanager = None

        super(SSLAdapter, self).__init__(**kwargs)

    def init_poolmanager(self, connections, maxsize, block=False):
        self.poolmanager = PoolManager(num_pools=connections,
                                       maxsize=maxsize,
                                       block=block,
                                       ssl_version=self.ssl_version)

Add ssl_version to the list of attributes, required when vnc_api gets called via multiprocessing module. This will ensure ssl_version gets included when pickle calls __getstate__ and __setstate__.
Add ssl_version to the list of attributes, required when vnc_api gets called via multiprocessing module.
This will ensure ssl_version gets included when pickle calls __getstate__ and __setstate__.

Courtesy: https://github.com/sigmavirus24/requests-toolbelt/commit/decadbd3512444889feb30cf1ff2f1448a3ecfca

Closes-Bug:#1604247

Change-Id: Iee9e0348c005e88c535f4da33cf98149a8c1b19d

  # -*- coding: utf-8 -*-
  # vim: tabstop=4 shiftwidth=4 softtabstop=4
  # @author: Sanju Abraham, Juniper Networks, OpenContrail
  from requests.adapters import HTTPAdapter
  try:
      # This is required for RDO, which installs both python-requests
      # and python-urllib3, but symlinks python-request's internally packaged
      # urllib3 to the site installed one.
      from requests.packages.urllib3.poolmanager import PoolManager
  except ImportError:
      # Fallback to standard installation methods
      from urllib3.poolmanager import PoolManager
  
  class SSLAdapter(HTTPAdapter):
      '''An HTTPS Transport Adapter that can be configured with SSL/TLS
         version.'''
+     HTTPAdapter.__attrs__.extend(['ssl_version'])
  
      def __init__(self, ssl_version=None, **kwargs):
          self.ssl_version = ssl_version
          self.poolmanager = None
  
          super(SSLAdapter, self).__init__(**kwargs)
  
      def init_poolmanager(self, connections, maxsize, block=False):
          self.poolmanager = PoolManager(num_pools=connections,
                                         maxsize=maxsize,
                                         block=block,
                                         ssl_version=self.ssl_version)
  
Add ssl_version to the list of attributes, required when vnc_api gets called via multiprocessing module. This will ensure ssl_version gets included when pickle calls __getstate__ and __setstate__.
## Code Before:
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# @author: Sanju Abraham, Juniper Networks, OpenContrail
from requests.adapters import HTTPAdapter
try:
    # This is required for RDO, which installs both python-requests
    # and python-urllib3, but symlinks python-request's internally packaged
    # urllib3 to the site installed one.
    from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
    # Fallback to standard installation methods
    from urllib3.poolmanager import PoolManager

class SSLAdapter(HTTPAdapter):
    '''An HTTPS Transport Adapter that can be configured with SSL/TLS
       version.'''

    def __init__(self, ssl_version=None, **kwargs):
        self.ssl_version = ssl_version
        self.poolmanager = None

        super(SSLAdapter, self).__init__(**kwargs)

    def init_poolmanager(self, connections, maxsize, block=False):
        self.poolmanager = PoolManager(num_pools=connections,
                                       maxsize=maxsize,
                                       block=block,
                                       ssl_version=self.ssl_version)

## Instruction:
Add ssl_version to the list of attributes, required when vnc_api gets called via multiprocessing module. This will ensure ssl_version gets included when pickle calls __getstate__ and __setstate__.
## Code After:
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# @author: Sanju Abraham, Juniper Networks, OpenContrail
from requests.adapters import HTTPAdapter
try:
    # This is required for RDO, which installs both python-requests
    # and python-urllib3, but symlinks python-request's internally packaged
    # urllib3 to the site installed one.
    from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
    # Fallback to standard installation methods
    from urllib3.poolmanager import PoolManager

class SSLAdapter(HTTPAdapter):
    '''An HTTPS Transport Adapter that can be configured with SSL/TLS
       version.'''
    HTTPAdapter.__attrs__.extend(['ssl_version'])

    def __init__(self, ssl_version=None, **kwargs):
        self.ssl_version = ssl_version
        self.poolmanager = None

        super(SSLAdapter, self).__init__(**kwargs)

    def init_poolmanager(self, connections, maxsize, block=False):
        self.poolmanager = PoolManager(num_pools=connections,
                                       maxsize=maxsize,
                                       block=block,
                                       ssl_version=self.ssl_version)
