Skip to content

Commit e1bee85

Browse files
Added _ca_certs property to _SSLAdapter to properly support pickling (broke in SDK v11.33) (dropbox#440)
* Added _ca_certs property to _SSLAdapter to properly support pickling * Added unittest to test session pickling
1 parent 4a3c7f5 commit e1bee85

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

dropbox/session.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
# TODO(kelkabany): We probably only want to instantiate this once so that even
4242
# if multiple Dropbox objects are instantiated, they all share the same pool.
4343
class _SSLAdapter(HTTPAdapter):
44+
_ca_certs = None
4445

4546
def __init__(self, *args, **kwargs):
4647
self._ca_certs = kwargs.pop("ca_certs", None) or _TRUSTED_CERT_FILE

test/unit/test_dropbox_unit.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

33
import mock
4+
import pickle
45

56
import pytest
67

@@ -404,3 +405,10 @@ def test_team_client_as_user(self, session_instance):
404405
app_secret=APP_SECRET,
405406
session=session_instance)
406407
dbx.as_user(TEAM_MEMBER_ID)
408+
409+
410+
class TestSession:
411+
def test_pickle_session(self):
412+
session_obj = create_session()
413+
pickled_session = pickle.dumps(session_obj)
414+
pickle.loads(pickled_session)

0 commit comments

Comments
 (0)