How to import Dropbox SDK into Google App Engine app?

I need a string

import dropbox 

work. I downloaded the Python Core API from Dropbox and copied the contents of the zip file into my (otherwise working) application folder. When I run my application, it causes the following error:

 ERROR 2013-08-07 19:47:04,111 wsgi.py:219] Traceback (most recent call last): File "/home/myusername/Downloads/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "/home/myusername/Downloads/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler handler = __import__(path[0]) File "/home/myusername/Downloads/appname/appname.py", line 1, in <module> import dropbox File "/home/myusername/Downloads/appname/dropbox/__init__.py", line 3, in <module> from . import client, rest, session File "/home/myusername/Downloads/appname/dropbox/client.py", line 14, in <module> from .rest import ErrorResponse, RESTClient File "/home/myusername/Downloads/appname/dropbox/rest.py", line 7, in <module> import pkg_resources ImportError: No module named pkg_resources 

How to fix this error?

+4
source share
2 answers

As indicated in the link posted by @Tim Dierks, you can solve this problem by creating the pkg_resouces module in the Dropbox folder with the contents

 def resource_filename(*args): cert_path = '/path/to/trusted-certs.crt' return cert_path 

As far as I can tell, pkg_resources needs only one method that returns the path to the certificate. trusted-certs.crt should be in your Dropbox source folder.

+1
source

You also need to package and distribute the pkg_resources module in the App Engine application. However, from what I saw elsewhere, after that you will encounter some other problems. It seems that the answers to Writing files to a Dropbox account from GAE got this work (for put, anyway).

0
source

Source: https://habr.com/ru/post/1495828/


All Articles