Hello, 

I am trying to use web2py to build an application that requests data from 
various google APIs.

Using my local install of Python 3 or Python 2, I am able to import the 
necessary modules and query the api. 

I have tried the following, restarting the webserver between each action:

1) copying google-api-python-client modules 
into C:\web2py\web2py\site-packages

   - This does not work, I get <type 'exceptions.AttributeError'> 'module' 
   object has no attribute 'DEFAULT_MAX_REDIRECTS'
   - package httplib2 definitely has a value called 'DEFAULT_MAX_REDIRECTS'
   - see Traceback #1

2) delete files and then cmd: python -m pip install --target= 
google-api-python-client

   - same result as first action
   - see Traceback #1

3) Copy or pip files to C:\web2py\web2py\applications\ping\modules


   - This does not work either, I get error: <type 
   'exceptions.ImportError'> cannot import name discovery
   - See Traceback #2


Has anyone successfully imported google-api-python-client into a web2py 
local instance?
Is there a setup step I am missing?

Full list of modules I am talking about is below, and the google 
instructions are here: 
https://developers.google.com/api-client-library/python/start/installation


Thank you!

Peter

___________________________________________________________________________________________________

Traceback #1

Traceback (most recent call last):
  File "C:\web2py\web2py\gluon\restricted.py", line 227, in restricted
    exec ccode in environment
  File "C:/web2py/web2py/applications/ping/models/db.py" 
<http://127.0.0.1:8000/admin/default/edit/ping/models/db.py>, line 10, in 
<module>
    from apiclient import discovery
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\apiclient\__init__.py", line 19, in 
<module>
    from googleapiclient import discovery
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\googleapiclient\discovery.py", line 56, 
in <module>
    from googleapiclient import _auth
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\googleapiclient\_auth.py", line 27, in 
<module>
    import oauth2client.client
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\oauth2client\client.py", line 39, in 
<module>
    from oauth2client import transport
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
    return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\oauth2client\transport.py", line 255, in 
<module>
    redirections=httplib2.DEFAULT_MAX_REDIRECTS,
AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'


----------------------------------------

Traceback #2

Traceback (most recent call last):
  File "C:\web2py\web2py\gluon\restricted.py", line 227, in restricted
    exec ccode in environment
  File "C:/web2py/web2py/applications/ping/models/db.py" 
<http://127.0.0.1:8000/admin/default/edit/ping/models/db.py>, line 10, in 
<module>
    from apiclient import discovery
  File "C:\web2py\web2py\gluon\custom_import.py", line 95, in custom_importer
    return base_importer(pname, globals, locals, fromlist, level)
  File "applications\ping\modules\apiclient\__init__.py", line 19, in <module>
    from googleapiclient import discovery
ImportError: cannot import name discovery


List of Modules

03/14/2017  11:57 AM    <DIR>          apiclient
03/14/2017  11:57 AM    <DIR>          googleapiclient
03/14/2017  11:57 AM    <DIR>         
 google_api_python_client-1.6.2.dist-info
03/14/2017  11:57 AM    <DIR>          httplib2
03/14/2017  11:57 AM    <DIR>          httplib2-0.10.3-py2.7.egg-info
03/14/2017  11:57 AM    <DIR>          oauth2client
03/14/2017  11:57 AM    <DIR>          oauth2client-4.0.0.dist-info
03/14/2017  11:57 AM    <DIR>          pyasn1
03/14/2017  11:57 AM    <DIR>          pyasn1-0.2.3.dist-info
03/14/2017  11:57 AM    <DIR>          pyasn1_modules
03/14/2017  11:57 AM    <DIR>          pyasn1_modules-0.0.8.dist-info
03/14/2017  11:57 AM    <DIR>          rsa
03/14/2017  11:57 AM    <DIR>          rsa-3.4.2.dist-info
03/14/2017  11:57 AM    <DIR>          six-1.10.0.dist-info
03/14/2017  11:49 AM            30,098 six.py
03/14/2017  11:57 AM    <DIR>          tests
03/14/2017  11:57 AM    <DIR>          uritemplate
03/14/2017  11:57 AM    <DIR>          uritemplate-3.0.0.dist-info

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to