Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposing requests as download data method for mobile, due to issues with certificates verification in pandas #123

Closed
magowiz opened this issue Mar 18, 2023 · 2 comments

Comments

@magowiz
Copy link

magowiz commented Mar 18, 2023

Hi,
like I described in issue #119, there are issues using meteostat in mobile devices: the reason may be that building system (buildozer+python-for-android) supports a too old version of pandas (1.0.3), the resulting behavior is that every time pandas tries to download a data file, fails because of certificate verification issue.

I created a fork of your code and I tried to change download method from pandas to requests, in last days I was able to conclude this small change and test it android emulator and it works.

Currently mine fork changes loader.py to make requests.get() fetch the gzip file, and I changed the pandas read_csv to read the file downloaded by requests.get(), I also try to open the gzip file and if it fails (no file or no gzip file) I raise a FileNotFondError in order to let original exception handling code initializes data variable correctly.

I would like to know if you can be interested in this small change (you can see it also in my loader.py of the repository I forked from yours https://github.com/magowiz/meteostat-python/blob/master/meteostat/core/loader.py) and how you would like to be the final behavior. I thought there could be an optional parameter to set in various class init methods, named for example mobile_mode=False, in this case I suppose, with mobile_mode set to False (default) we can use read_csv also to download files, as done by your original package, with mobile_mode=True we use requests for download.

What do you think about it? I know it is a workaround for a particular and not so used platform, so I will understand if you want to keep things how they are. I also filled a bug report to kivy/buildozer (here if you interested kivy/buildozer#1578 )because the pandas version they use with recipes fails to integrate with ssl setup, while other libraries like requests work flawlessly.

@clampr
Copy link
Member

clampr commented Mar 22, 2023

Interesting finding!

My feeling is that this should be fixed on https://github.com/kivy/buildozer. Especially, since we set the min version for Pandas to 1.1. The certificate issue might just be one of many possible issues related to this outdated Pandas version.

@magowiz
Copy link
Author

magowiz commented Mar 26, 2023

I agree with you, I'll keep the workaround for myself, meanwhile I'll try to ask if there is a plan to create a recipe for a more recent version of pandas. I will also try to install a more recent version of pandas that's not last one, because with last one patches in recipe fails.

@clampr clampr closed this as completed Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants