<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: python3 and API V2: turn off certificate checking? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408515#M22147</link>
    <description>&lt;P&gt;I don't believe the&amp;nbsp;Dropbox Python SDK offers such an option, but I either way I would strongly&amp;nbsp;recommend against disabling certificate checking anyway.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Apr 2020 18:45:07 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-04-09T18:45:07Z</dc:date>
    <item>
      <title>python3 and API V2: turn off certificate checking?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408191#M22140</link>
      <description>&lt;P&gt;I'm using python3 and used pip install dropbox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On my home machine, I use the sample with&lt;/P&gt;&lt;PRE&gt;dbx.users_get_curent_account()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;and it works fine.&amp;nbsp; On the work VPN, I get a stream of exceptions (pasted below) the bottom line is &lt;STRONG&gt;requests&lt;/STRONG&gt; is refusing to connect because of "Self signed cretificate in certificate chain".&amp;nbsp; What I would like to do is catch the exception and offer the user a chance to retry without certificate checks.&amp;nbsp; Is this possible with the API V2?&amp;nbsp; I looked at the source of &lt;STRONG&gt;class Dropbox&lt;/STRONG&gt; and &lt;STRONG&gt;create_session&amp;nbsp;&lt;/STRONG&gt;but can't see anything likely looking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Source/dropbox $ cat demo.py

import dropbox

dbx=dropbox.Dropbox('oLvM1y1OkxIAAAAAAAAEYiHj9UyVA1EME8CGGsxnMp-e2DGlAaqutsyuXejU_k7d')

print( dbx.users_get_current_account() )

Source/dropbox $ py demo.py
Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\site-packages\urllib3\connectionpool.py", line 662, in urlopen
    self._prepare_proxy(conn)
  File "C:\Program Files\Python37\lib\site-packages\urllib3\connectionpool.py", line 948, in _prepare_proxy
    conn.connect()
  File "C:\Program Files\Python37\lib\site-packages\urllib3\connection.py", line 394, in connect
    ssl_context=context,
  File "C:\Program Files\Python37\lib\site-packages\urllib3\util\ssl_.py", line 370, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Program Files\Python37\lib\ssl.py", line 423, in wrap_socket
    session=session
  File "C:\Program Files\Python37\lib\ssl.py", line 870, in _create
    self.do_handshake()
  File "C:\Program Files\Python37\lib\ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\site-packages\requests\adapters.py", line 449, in send
    chunked=chunked
  File "C:\Program Files\Python37\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "C:\Program Files\Python37\lib\site-packages\urllib3\util\retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.dropboxapi.com', port=443): Max retries exceeded with url: /2/users/get_current_account (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "demo.py", line 6, in &amp;lt;module&amp;gt;
    print( dbx.users_get_current_account() )
  File "C:\Program Files\Python37\lib\site-packages\dropbox\base.py", line 5069, in users_get_current_account
    None,
  File "C:\Program Files\Python37\lib\site-packages\dropbox\dropbox.py", line 274, in request
    timeout=timeout)
  File "C:\Program Files\Python37\lib\site-packages\dropbox\dropbox.py", line 365, in request_json_string_with_retry
    timeout=timeout)
  File "C:\Program Files\Python37\lib\site-packages\dropbox\dropbox.py", line 449, in request_json_string
    timeout=timeout,
  File "C:\Program Files\Python37\lib\site-packages\requests\sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Program Files\Python37\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\Program Files\Python37\lib\site-packages\requests\adapters.py", line 469, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.dropboxapi.com', port=443): Max retries exceeded with url: /2/users/get_current_account (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Apr 2020 20:31:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408191#M22140</guid>
      <dc:creator>sweavo</dc:creator>
      <dc:date>2020-04-08T20:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: python3 and API V2: turn off certificate checking?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408195#M22141</link>
      <description>&lt;P&gt;... and yes, duh, I pasted my token.&amp;nbsp; I've revoked it.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 20:37:27 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408195#M22141</guid>
      <dc:creator>sweavo</dc:creator>
      <dc:date>2020-04-08T20:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: python3 and API V2: turn off certificate checking?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408515#M22147</link>
      <description>&lt;P&gt;I don't believe the&amp;nbsp;Dropbox Python SDK offers such an option, but I either way I would strongly&amp;nbsp;recommend against disabling certificate checking anyway.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 18:45:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408515#M22147</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-04-09T18:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: python3 and API V2: turn off certificate checking?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408686#M22157</link>
      <description>&lt;P&gt;Alternatively, getting to add a trusted root certificate would work too.&amp;nbsp; requests can do this, and requests is used under the hood, I'm looking for a way to set up requests under the dropbox module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 08:51:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408686#M22157</guid>
      <dc:creator>sweavo</dc:creator>
      <dc:date>2020-04-10T08:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: python3 and API V2: turn off certificate checking?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408797#M22165</link>
      <description>&lt;P&gt;The&amp;nbsp;Dropbox Python SDK does use the requests library. You can find where it's imported and used &lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/9c3302a3c69263fbc3254b36f3cc267225f784d1/dropbox/dropbox.py#L17" target="_self"&gt;here&lt;/A&gt; and &lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/c53a27e34c82a046853a1e94907c539f05cf5b94/dropbox/session.py#L5" target="_self"&gt;here&lt;/A&gt;. The trusted certificates are loaded from &lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/master/dropbox/trusted-certs.crt" target="_self"&gt;this file&lt;/A&gt; at &lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/c53a27e34c82a046853a1e94907c539f05cf5b94/dropbox/session.py#L43" target="_self"&gt;this point&lt;/A&gt; in the code. You could potentially modify that file or code, though I should reiterate again that as a matter of security we do not&amp;nbsp;recommend doing so.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 15:15:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/python3-and-API-V2-turn-off-certificate-checking/m-p/408797#M22165</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-04-10T15:15:25Z</dc:date>
    </item>
  </channel>
</rss>

