Forum Archive

Does the dropbox 6.4.0 library support TLS 1.2?

dthomson

I received an automated email from Dropbox warning me that my app is accessing Dropbox using a deprecated version of TLS:

"We’re reaching out because your app(s) have recently made calls to the Dropbox API using a deprecated TLS protocol version.
Beginning on or after April 13, the Dropbox API will require that calls use TLS 1.2 or greater. Traffic using TLS 1.0 or 1.1 will be rejected.

The latest Dropbox SDKs will select TLS 1.2 when available in the environment, but versions over two years old may require an update. In particular, users of the Dropbox Java SDK should update to v3.1.1 (released June, 2019) or later & Dropbox Python SDK should update to v8.4.1 (released November, 2017) or later.".

The Dropbox library included in Pythonista 3 is version 6.4.0. Does anyone know if it supports TLS 1.2? Has anyone else accessing Dropbox from Pythonista received this email?

Thanks.

dthomson

UPDATE: As of today the 6.4.0 version of the dropbox library included in Pythonista 3 is no longer functional. Dropbox, as promised, is no longer allowing connections using versions of TLS older than 1.2.

bosco

@dthomson You may want to look at this post.
https://forum.omz-software.com/topic/7014/how-to-refresh-dropbox-access-token-with-the-older-dropbox-library-included-with-pythonista/2
I installed dropbox version 11.7.0 a year ago and I appears to still be working today.

WilliD55

@bosco : I followed your instructions and I now have a copy of dropbox 11.7.0 in site-package-3. How do I import the newer version into my Skript rather than dropbox 6.4.0?

JonB

Just force quit pythonista, then open again. If you are using python 3, then importing will check site-packages first.

Jonathano

I tried that instruction but there are errors when I install requests and others.
After installing them module error comes even for pip.

is there any step by step instruction for solving this?

JonB

Oh sorry, I misread your post .

Once you have the new Dropbox module, you simply import it. The site-packages folder takes precedence over built-in site-packages.

JonB

You need to post your actual errors.
A common problem with trying to update requests is if you didn't do a complete job, you need to delete requests, idna and chardet from site-packages-3 or site-packages, and then for e quit. Then in stash:

pip install requests
pip install chardet
pip install idna

Those must be done within a single session of stash.

Jonathano

@JonB Thank you for your explanation.

I tried reinstall Pythonista and install stash.
Then remove requests folder(which comes from search (requests) ) and install requests.
When I tried this file fetch error comes.
(exact message - error : failed to fetch package release urls.)

And others also show info file of packages requests(..) not found and similar errors.

ADDED : I just found requests are in standard library(3.6)/site-packages and standard library(2.7)/site-packages.
These are not removable, even it disappear when I send them a trash.
And site-packages, -2. or -3 in a root, there are no requests.

esme_02

If you want to solve this issue check out this link below
https://forum.omz-software.com/topic/7014/how-to-refresh-dropbox-access-token-with-the-older-dropbox-library-included-with-pythonista/2
or solve the apk file from here

JonB

@Jonathano ok, let's try this...

Open stash, and type

ls ~\Documents\site-packages

ls ~\Documents\site-packages-3

ls ~\Documents\site-packages-2

And paste the results back here of each command.

Next, type

stashconf py_traceback 1

Then try using pip, say

pip install pip-install-test

And post the entire traceback here

```

Jonathano

@JonB
Thank you for your patience.
These are what I got from Pythonista in my iPad.

[~/Documents]$ ls site-packages
site-packages/:
Readme.md stash

[~/Documents]$ ls site-packages-2
site-packages-2/:
Readme.md

[~/Documents]$ ls site-packages-3
site-packages-3/:
pip_index.json Readme.md

[~/Documents]$ stashconf py_traceback 1
[~/Documents]$ pip install pip-install-test
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/15/8e/4fbc92846184e1080af77da38d55928a5486e0bc5e2ec8342c7db378d7f1/pip_install_test-0.5-py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/47FC53DC-CAB6-4B6B-B50F-7EE750FCBB79/tmp//pip_install_test-0.5-py3-none-any.whl (1707 bytes)
[====================] 100.00% | 1.7KiB
Installing wheel: pip_install_test-0.5-py3-none-any.whl...
Package installed: pip-install-test

JonB

Ok... So pip is working. I guess I misunderstood where you were getting errors?

Do the stashconf line again, then pip install the various modules you need for Dropbox --- then post the full session again if there are errors.

Jonathano

@JonB
I removed Pythonista and reinstall it.
Then install stash.

(install with this code : import requests as r; exec(r.get('https://bit.ly/get-stash').content) )

Then I did what I wrote just before.

Now I tried again as below;
But there is error.

~/Documents]$ stashconf py_traceback 1
[~/Documents]$ pip install requests
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/2d/61/08076519c80041bc0ffa1a8af0cbd3bf3e2b62af10435d269a9d0f40564d/requests-2.27.1-py2.py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/47FC53DC-CAB6-4B6B-B50F-7EE750FCBB79/tmp//requests-2.27.1-py2.py3-none-any.whl (63133 bytes)
[====================] 100.00% | 61.7KiB
Installing wheel: requests-2.27.1-py2.py3-none-any.whl...
Warning: unknown dependency requirement: 'sys_platform'
Warning: Adding dependency 'win-inet-pton', ignoring requirements for dependency.
Package installed: requests
Installing dependency: urllib3[('<', '1.27'), ('>=', '1.21.1')] (required by: requests)
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/ec/03/062e6444ce4baf1eac17a6a0ebfe36bb1ad05e1df0e20b110de59c278498/urllib3-1.26.9-py2.py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/47FC53DC-CAB6-4B6B-B50F-7EE750FCBB79/tmp//urllib3-1.26.9-py2.py3-none-any.whl (138990 bytes)
[====================] 100.00% | 135.7KiB
Installing wheel: urllib3-1.26.9-py2.py3-none-any.whl...
Warning: unknown dependency requirement: 'os_name'
Warning: Adding dependency 'brotlicffi (>=0.8.0)', ignoring requirements for dependency.
Warning: unknown dependency requirement: 'os_name'
Warning: Adding dependency 'brotli (>=1.0.9)', ignoring requirements for dependency.
Warning: unknown dependency requirement: 'os_name'
Warning: Adding dependency 'brotlipy (>=0.6.0)', ignoring requirements for dependency.
Package installed: urllib3
Installing dependency: brotlicffi[('>=', '0.8.0')] (required by: urllib3)
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/d3/d8/6acbb65e350213ad6bd96180593fad0a269a3baa845c67fed21adee3959d/brotlicffi-1.0.9.2.tar.gz

Save as: /private/var/mobile/Containers/Data/Application/47FC53DC-CAB6-4B6B-B50F-7EE750FCBB79/tmp//brotlicffi-1.0.9.2.tar.gz (440077 bytes)
[====================] 100.00% | 429.8KiB
Extracting archive file ...
Archive extracted.
Running setup file ...
Package installed: brotlicffi
Installing dependency: cffi[('>=', '1.0.0')] (required by: brotlicffi)
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/00/9e/92de7e1217ccc3d5f352ba21e52398372525765b2e0c4530e6eb2ba9282a/cffi-1.15.0.tar.gz

Save as: /private/var/mobile/Containers/Data/Application/47FC53DC-CAB6-4B6B-B50F-7EE750FCBB79/tmp//cffi-1.15.0.tar.gz (484058 bytes)
[====================] 100.00% | 472.7KiB
Extracting archive file ...
Archive extracted.
Running setup file ...
PermissionError(1, 'Operation not permitted')
Failed to run setup.py
Fall back to directory guessing ...
Package installed: cffi
Installing dependency: enum34;python_version[('<', "'3.4'")] (required by: brotlicffi)
Querying PyPI ...
Error: Failed to fetch package release urls

JonB

Ok, let's try this.

First, are you running python3 with stash? Check what stash says when it first starts.

rm -rf ~/Documents/site-packages*/urllib3 

Next, install urllib3 1.21.1

pip install urllib3==1.21.1

Then try
pip install requests

And paste what we get (always do the stashconf line)

Seems newer urllib3 are not compatible with pythonista due to some external dependencies...

Jonathano

@JonB
Sorry I was too busy due to my works.

I followed your instruction.
But I have an error when I tried this.

pip install urllib3==1.21.1
/private/var/mobile/Containers/Shared/AppGroup/7FD2AC7F-F7F2-40E3-8885-7136C55974E5/Pythonista3/Documents/site-packages-3/requests/init.py:104: RequestsDependencyWarning: urllib3 (1.14) or chardet (4.0.0)/charset_normalizer (None) doesn't match a supported version!
RequestsDependencyWarning)
stash: : cannot import name 'InvalidHeader'

JonB

ok, i ran these instructions, and it worked fine. so lets take this step by step.

First, run stash.

Next, type selfupdate
force quit, then run stash again.

now, paste what you see:

StaSh v0.7.5 on python 3.6.1
Warning: you are running StaSh in python3. Some commands may not work correctly in python3.
Please help us improving StaSh by reporting bugs on github.
Tip: You can use the callable StaSh object to issue more commands from a script, e.g. _stash('some_command')
[~/Documents]$ 

if it instead says you are running on python 2.7, we will need to fix that.

assuming you are running on py3, continue:

pip list

paste results here.

Next, lets delete everything in site packages, except stash.

rm -rf site-packages-3/*
rm -rf site-packages-3/.*

These might take a while... wait until promot returns.

Force quit again, launch stash.
Now, lets install urllib3, followed by requests:

StaSh v0.7.5 on python 3.6.1
Warning: you are running StaSh in python3. Some commands may not work correctly in python3.
Please help us improving StaSh by reporting bugs on github.
Tip: Show detailed traceback when a script fails with stashconf py_traceback 1
[~/Documents]$ pip install urllib3==1.21.1
Querying PyPI ... 
Downloading package ...
Opening: https://files.pythonhosted.org/packages/24/53/f397db567de0aa0e81b211d81c13c41a779f14893e42189cf5bdb97611b2/urllib3-1.21.1-py2.py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/A2523AAF-82EC-4BCD-B197-85DEBFB5F1DD/tmp/urllib3-1.21.1-py2.py3-none-any.whl (131717 bytes)
[====================] 100.00% | 128.6KiB          
Installing wheel: urllib3-1.21.1-py2.py3-none-any.whl...
Package installed: urllib3
[~/Documents]$ pip list
urllib3 (1.26.9) - HTTP library with thread-safe connection pooling, file post, and more.
[~/Documents]$ pip install requests
Querying PyPI ... 
Downloading package ...
Opening: https://files.pythonhosted.org/packages/2d/61/08076519c80041bc0ffa1a8af0cbd3bf3e2b62af10435d269a9d0f40564d/requests-2.27.1-py2.py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/A2523AAF-82EC-4BCD-B197-85DEBFB5F1DD/tmp/requests-2.27.1-py2.py3-none-any.whl (63133 bytes)
[====================] 100.00% | 61.7KiB          
Installing wheel: requests-2.27.1-py2.py3-none-any.whl...
Warning: unknown dependency requirement: 'sys_platform'
Warning: Adding dependency 'win-inet-pton', ignoring requirements for dependency.
Package installed: requests
Dependency already installed: urllib3
Installing dependency: certifi[('>=', '2017.4.17')] (required by: requests)
Querying PyPI ... 
Downloading package ...
Opening: https://files.pythonhosted.org/packages/11/dd/e015f3780f42dd9af62cf0107b44ea1298926627ecd70c17b0e484e95bcd/certifi-2022.5.18.1-py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/A2523AAF-82EC-4BCD-B197-85DEBFB5F1DD/tmp/certifi-2022.5.18.1-py3-none-any.whl (155170 bytes)
[====================] 100.00% | 151.5KiB          
Installing wheel: certifi-2022.5.18.1-py3-none-any.whl...
Package installed: certifi
Installing dependency: charset-normalizer[('~=', '2.0.0')] (required by: requests)
Querying PyPI ... 
Downloading package ...
Opening: https://files.pythonhosted.org/packages/06/b3/24afc8868eba069a7f03650ac750a778862dc34941a4bebeb58706715726/charset_normalizer-2.0.12-py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/A2523AAF-82EC-4BCD-B197-85DEBFB5F1DD/tmp/charset_normalizer-2.0.12-py3-none-any.whl (39623 bytes)
[====================] 100.00% | 38.7KiB          
Installing wheel: charset_normalizer-2.0.12-py3-none-any.whl...
Package installed: charset-normalizer
Installing dependency: idna[('<', '4'), ('>=', '2.5')] (required by: requests)
Querying PyPI ... 
Downloading package ...
Opening: https://files.pythonhosted.org/packages/04/a2/d918dcd22354d8958fe113e1a3630137e0fc8b44859ade3063982eacd2a4/idna-3.3-py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/A2523AAF-82EC-4BCD-B197-85DEBFB5F1DD/tmp/idna-3.3-py3-none-any.whl (61160 bytes)
[====================] 100.00% | 59.7KiB          
Installing wheel: idna-3.3-py3-none-any.whl...
Package installed: idna
Installing dependency: win-inet-pton (required by: requests)
Querying PyPI ... 
Downloading package ...
Opening: https://files.pythonhosted.org/packages/be/31/ff772a44aa56319df8afbb0b34f1a856f66f05b9d5f1fed917849e47fdae/win_inet_pton-1.1.0-py2.py3-none-any.whl

Save as: /private/var/mobile/Containers/Data/Application/A2523AAF-82EC-4BCD-B197-85DEBFB5F1DD/tmp/win_inet_pton-1.1.0-py2.py3-none-any.whl (4848 bytes)
[====================] 100.00% | 4.7KiB          
Installing wheel: win_inet_pton-1.1.0-py2.py3-none-any.whl...
Package installed: win-inet-pton
[~/Documents]$ 
JonB

now, to install dropbox, turns out the package info is all screwed up.
but we can patch pip to handle it

edit site-packages/stash/bin/pip.py

around line 1552, you will see

    def _package_releases(self, pkg_data):
        return pkg_data['releases'].keys() 

modify as follows

    def _package_releases(self, pkg_data):
        return [ key for key in pkg_data['releases'].keys() if pkg_data['releases'][key] ]

then, back in stash,

pip install dropbox

now you can follow the other thread instructions for authorizing, etc.

bellajames

Thanks for this informative post
restaurant order management system

vittynext

Do the stashconf line again, then pip install the various modules you need for Dropbox --- then post the full session again if there are errors. teatv download

hellodear.in

ccc
return [ key for key in pkg_data['releases'].keys() if pkg_data['releases'][key] ]
# -->
return [key for key, value in pkg_data['releases'].items() if value]
americanhydrocar

Thanks for the best blog. it was very useful for me.keep sharing such ideas in the future as well.

C8 corvette HTC
C8 Corvette Z06
C8 corvette stingray
C7 corvette grand sport
C7 Corvette Z06