Skip to content

Commit

Permalink
Merge pull request docker#1640 from zero57/add_attrs_for_pickling
Browse files Browse the repository at this point in the history
Add attributes for pickling
  • Loading branch information
shin- authored Jun 22, 2017
2 parents a3b1059 + 0165a34 commit b9e5863
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ class APIClient(
configuration.
user_agent (str): Set a custom user agent for requests to the server.
"""

__attrs__ = requests.Session.__attrs__ + ['_auth_configs',
'_version',
'base_url',
'timeout']

def __init__(self, base_url=None, version=None,
timeout=DEFAULT_TIMEOUT_SECONDS, tls=False,
user_agent=DEFAULT_USER_AGENT, num_pools=DEFAULT_NUM_POOLS):
Expand Down
5 changes: 5 additions & 0 deletions docker/transport/npipeconn.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def _get_conn(self, timeout):


class NpipeAdapter(requests.adapters.HTTPAdapter):

__attrs__ = requests.adapters.HTTPAdapter.__attrs__ + ['npipe_path',
'pools',
'timeout']

def __init__(self, base_url, timeout=60,
pool_connections=constants.DEFAULT_NUM_POOLS):
self.npipe_path = base_url.replace('npipe://', '')
Expand Down
4 changes: 4 additions & 0 deletions docker/transport/ssladapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
class SSLAdapter(HTTPAdapter):
'''An HTTPS Transport Adapter that uses an arbitrary SSL version.'''

__attrs__ = HTTPAdapter.__attrs__ + ['assert_fingerprint',
'assert_hostname',
'ssl_version']

def __init__(self, ssl_version=None, assert_hostname=None,
assert_fingerprint=None, **kwargs):
self.ssl_version = ssl_version
Expand Down
5 changes: 5 additions & 0 deletions docker/transport/unixconn.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def _new_conn(self):


class UnixAdapter(requests.adapters.HTTPAdapter):

__attrs__ = requests.adapters.HTTPAdapter.__attrs__ + ['pools',
'socket_path',
'timeout']

def __init__(self, socket_url, timeout=60,
pool_connections=constants.DEFAULT_NUM_POOLS):
socket_path = socket_url.replace('http+unix://', '')
Expand Down

0 comments on commit b9e5863

Please sign in to comment.