Google app engine Federated (openid) login localhost - google-app-engine

I am trying to use this script for federated login with google's app engine. This works on the deployed app engine but with localhost it gives this error:
Traceback (most recent call last):
File "/workspace/python/app_en/google_appengine/google/appengine/ext/webapp/__init__.py", line 515, in __call__
handler.get(*groups)
File "/workspace/python/app_en/bingousie/helloworld.py", line 23, in get
p['login_url'] = users.create_login_url(federated_identity=p_url)
File "/workspace/python/app_en/google_appengine/google/appengine/api/users.py", line 216, in create_login_url
apiproxy_stub_map.MakeSyncCall('user', 'CreateLoginURL', req, resp)
File "/workspace/python/app_en/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 86, in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
File "/workspace/python/app_en/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 286, in MakeSyncCall
rpc.CheckSuccess()
File "/workspace/python/app_en/google_appengine/google/appengine/api/apiproxy_rpc.py", line 149, in _WaitImpl
self.request, self.response)
File "/workspace/python/app_en/google_appengine/google/appengine/api/apiproxy_stub.py", line 73, in MakeSyncCall
if request.ByteSize() > self.__max_request_size:
File "/workspace/python/app_en/google_appengine/google/appengine/api/user_service_pb.py", line 178, in ByteSize
n += self.lengthString(len(self.destination_url_))
TypeError: object of type 'NoneType' has no len()
Is this because the openid servers do not allow logging in to local site? If it is then it why doesn't it at least work with myopenid.com (I use it for my django openid authentication on local server).

In the create_login_url call you should specify the dest_url parameter.
dest_url can be full URL or a path
relative to your application's domain.
I had the same problem here.

Related

AssertionError: No api proxy found for service "logservice"

I am trying to run django in appengine locally, and I get this erro - AssertionError: No api proxy found for service "logservice"
What does this mean? Am I missing something in the setup?
I run it by the following command:
PYTHONPATH=/lib/python2.7/site-packages/ dev_appserver.py app.yaml
Full stacktrace -
Traceback (most recent call last):
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1302, in communicate
req.respond()
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 831, in respond
self.server.gateway(self).respond()
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 287, in __call__
return app(environ, start_response)
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/request_rewriter.py", line 314, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/request_handler.py", line 165, in __call__
self._flush_logs(response.get('logs', []))
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/request_handler.py", line 303, in _flush_logs
apiproxy_stub_map.MakeSyncCall('logservice', 'Flush', request, response)
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 95, in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
File "/Users/Dev/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 322, in MakeSyncCall
assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "logservice"

Error using remote_api_shell.py: ssl.SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol

I'm tyring to use remote_api_shell.py to access the datastore of my Google App Engine application in the following way:
remote_api_shell.py -s url/of/server --secure
But I get the following error:
Traceback (most recent call last):
File "./remote_api_shell.py", line 133, in <module>
run_file(__file__, globals())
File "./remote_api_shell.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py", line 160, in <module>
main(sys.argv)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py", line 156, in main
oauth2=True)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/remote_api_shell.py", line 74, in remote_api_shell
secure=secure)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 768, in ConfigureRemoteApiForOAuth
rpc_server_factory=rpc_server_factory)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 835, in ConfigureRemoteApi
app_id = GetRemoteAppIdFromServer(server, path, rtok)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 569, in GetRemoteAppIdFromServer
response = server.Send(path, payload=None, **urlargs)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appengine_rpc_httplib2.py", line 245, in Send
url, method=method, body=payload, headers=headers)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/lib/oauth2client/oauth2client/client.py", line 562, in new_request
redirections, connection_type)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/lib/httplib2/httplib2/__init__.py", line 1584, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/lib/httplib2/httplib2/__init__.py", line 1332, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/lib/httplib2/httplib2/__init__.py", line 1268, in _conn_request
conn.connect()
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/lib/httplib2/httplib2/__init__.py", line 1014, in connect
self.disable_ssl_certificate_validation, self.ca_certs)
File "/home/vagrant/google-cloud-sdk/platform/google_appengine/lib/httplib2/httplib2/__init__.py", line 80, in _ssl_wrap_socket
cert_reqs=cert_reqs, ca_certs=ca_certs)
File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 243, in __init__
self.do_handshake()
File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
Any help would be appreciated.
The problem went away when I switched from using my custom domain name to my-app-id.appspot.com.
Some other considerations:
If you are using https, then your-app-id.appspot.com will not work out of the box. You have to enable it on the Google Apps page corresponding to the domain name. Yes, that means that you will actually have to have Google Apps setup for that domain.
If you have a multi-module setup, make sure you add remote_api: on to the builtins section of the app.yaml of the default module. Or if you have remote-api: on for another module, then use the url that skips the dispatch.yaml file and targets the module directly.

An unknown error has occured in the Java remote_api handler for this call

I'm trying to use bulkloader to load entities to my GAE app, which is already hosted on GAE. I'm not using DEV server now. It was all fine couple of weeks ago, when I left the app, now after like 2 or 3 updates of GoogleAppEngineLauncher to 1.9 I can't use same commands as before to load entities, because it ends with tons of errors:
[INFO ] Connecting to my-app.appspot.com/remote_api
Traceback (most recent call last):
File "/usr/local/bin/appcfg.py", line 126, in <module>
run_file(__file__, globals())
File "/usr/local/bin/appcfg.py", line 122, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4934, in <module>
main(sys.argv)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4925, in main
result = AppCfgApp(argv).Run()
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 2648, in Run
self.action(self)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4605, in __call__
return method()
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4417, in PerformUpload
run_fn(args)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4298, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py", line 4408, in Run
return _PerformBulkload(arg_dict)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py", line 4273, in _PerformBulkload
loader.finalize()
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/bulkload/bulkloader_config.py", line 382, in finalize
self.reserve_keys(self.keys_to_reserve)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py", line 1217, in ReserveKeys
datastore._GetConnection()._reserve_keys(ConvertKeys(keys))
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 2108, in _reserve_keys
self._async_reserve_keys(None, keys).get_result()
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 890, in get_result
results = self.__rpcs[0].get_result()
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 612, in get_result
return self.__get_result_hook(self)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 2151, in __reserve_keys_hook
self.check_rpc_success(rpc)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1331, in check_rpc_success
rpc.check_success()
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 578, in check_success
self.__rpc.CheckSuccess()
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_rpc.py", line 156, in _WaitImpl
self.request, self.response)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "/Applications/ADT/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 236, in _MakeRealSyncCall
raise UnknownJavaServerError("An unknown error has occured in the "
google.appengine.ext.remote_api.remote_api_stub.UnknownJavaServerError: An unknown error has occured in the Java remote_api handler for this call.
AppEngine is written in JAVA, however I use python sdk to use bulkloader.
Same day I used Datastore Admin to wipe app database. This uses much quotas, and this is why upload was failing (just guessing). Still it's weird since my project has billing enabled.

Combine large files in Blobstore GAE FileNotOpenedError: ApplicationError: 10

I'm trying merge 2 files and to create one new in the BlobStore of the AppEngine. This files are 12.000 rows and have 12 MB. The problem occurs when i writte the new file, because in middle of write appear the next error:
ApplicationError: 10
Traceback (most recent call last):
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 716, in __call__
handler.post(*groups)
File "/base/data/home/apps/s~ono-hat-vv2/1.369681903434492066/com/__init__.py", line 244, in post
self.principal(cont+1, numFicheritos,"csvTotal","uniendoCSV")
File "/base/data/home/apps/s~ono-hat-vv2/1.369681903434492066/com/__init__.py", line 277, in principal
self.escribirtxt(f, cadenaSalida)
File "/base/data/home/apps/s~ono-hat-vv2/1.369681903434492066/com/__init__.py", line 308, in escribirtxt
f.write(linea)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 326, in write
self._make_rpc_call_with_retry('Append', request, response)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 427, in _make_rpc_call_with_retry
_make_call(method, request, response)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 252, in _make_call
_raise_app_error(e)
File "/base/data/home/runtimes/python/python_lib/versions/1/google/appengine/api/files/file.py", line 195, in _raise_app_error
raise FileNotOpenedError(e)
FileNotOpenedError: ApplicationError: 10
I have read that the problem is in the time that I open the file, because this can't be greater that 30 s. How can i resolve this problem and merge this file?
Close the file and re-open every so often.
Have you looked at Google Cloud Storage? It may not have this limitation and also the app engine files api has been deprecated and we need to move in that direction anyway. Something to consider.

SMTPServerDisconnected issue

My Google app engine application needs to send out email(what ever we get the data from screen). On development server i specify my smtp configuration (host,port,user,password) while starting the server. then I am running my application in that form after I submitted the data its showing error as
**Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 500, in __call__
handler.post(*groups)
File "C:\Documents and Settings\desk\Desktop\apps\temp\main.py", line 139, in post
""")
File "C:\Program Files\Google\google_appengine\google\appengine\api\mail.py", line 205, in send_mail
message.send(make_sync_call)
File "C:\Program Files\Google\google_appengine\google\appengine\api\mail.py", line 474, in send
make_sync_call('mail', self._API_CALL, message, response)
File "C:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 68, in MakeSyncCall
apiproxy.MakeSyncCall(service, call, request, response)
File "C:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 240, in MakeSyncCall
stub.MakeSyncCall(service, call, request, response)
File "C:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub.py", line 80, in MakeSyncCall
method(request, response)
File "C:\Program Files\Google\google_appengine\google\appengine\api\mail_stub.py", line 203, in _Send
self._SendSMTP(mime_message, smtp_lib)
File "C:\Program Files\Google\google_appengine\google\appengine\api\mail_stub.py", line 139, in _SendSMTP
smtp.quit()
File "C:\Python26\lib\smtplib.py", line 730, in quit
res = self.docmd("quit")
File "C:\Python26\lib\smtplib.py", line 362, in docmd
self.putcmd(cmd,args)
File "C:\Python26\lib\smtplib.py", line 318, in putcmd
self.send(str)
File "C:\Python26\lib\smtplib.py", line 310, in send
raise SMTPServerDisconnected('please run connect() first')
SMTPServerDisconnected: please run connect() first**
its telling that SMTPServerDisconnected, please run connect() first
following code I am using
mail.send_mail(sender="abc#xyz.com",
to="def#xyz.com",
subject="Test Message",
body="""
Dear Albert:
Your example.com account has been approved. You can now visit
http://www.example.com/ and sign in using your Google Account to
access new features.
Please let us know if you have any questions.
The example.com Team
""")
please tell me what is the wrong in this code i am new to Python and Google Apps
I am waiting for any one reply
Thanks in advance
Which SMTP server are you configured to use?: http://code.google.com/appengine/docs/python/tools/devserver.html#Using_Mail
SMTP Host is going to be the SMTP server's (i.e. your mail relay) fully qualified domain name (not an email address, but a server name on the network).

Resources