Skip to content

Commit

Permalink
Added _ca_certs property to _SSLAdapter to properly support pickling …
Browse files Browse the repository at this point in the history
…(broke in SDK v11.33) (#440)

* Added _ca_certs property to _SSLAdapter to properly support pickling

* Added unittest to test session pickling
  • Loading branch information
dennissiemensma authored Aug 4, 2022
1 parent 4a3c7f5 commit e1bee85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions dropbox/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# TODO(kelkabany): We probably only want to instantiate this once so that even
# if multiple Dropbox objects are instantiated, they all share the same pool.
class _SSLAdapter(HTTPAdapter):
_ca_certs = None

def __init__(self, *args, **kwargs):
self._ca_certs = kwargs.pop("ca_certs", None) or _TRUSTED_CERT_FILE
Expand Down
8 changes: 8 additions & 0 deletions test/unit/test_dropbox_unit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

import mock
import pickle

import pytest

Expand Down Expand Up @@ -404,3 +405,10 @@ def test_team_client_as_user(self, session_instance):
app_secret=APP_SECRET,
session=session_instance)
dbx.as_user(TEAM_MEMBER_ID)


class TestSession:
def test_pickle_session(self):
session_obj = create_session()
pickled_session = pickle.dumps(session_obj)
pickle.loads(pickled_session)

0 comments on commit e1bee85

Please sign in to comment.