Change google app engine name - google-app-engine

i cloned a working google app engine repo into my local env and got it to work.
Later i decided i wanted to deploy to my own GAE app so i changed the name in app.yaml to the one in my newly created app.
But then when launching it with the GoogleAppEngineLauncher i got this error:
BadRequestError: app "dev~bandtasticnews" cannot access app "dev~noticiashacker"'s data
The original name is noticiashacker and the new one is bandtasticnews, the cloned worked alright online but the dev is broken, i have to change the name on app.yaml to the original if i want it to launch locally and return it before deploying.
There are no more lines on my code referencing the original name, i don't know why is it trying to retrieve it.
UPDATE
Here is the stack trace shown in the GoogleAppEngineLauncher logs
*** Running dev_appserver with the following flags:
--skip_sdk_update_check=yes --port=8080 --admin_port=8000 --clear_datastore=yes
Python command: /usr/bin/python2.7
INFO 2013-04-24 00:45:10,683 devappserver2.py:498] Skipping SDK update check.
WARNING 2013-04-24 00:45:10,690 api_server.py:328] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-04-24 00:45:10,693 api_server.py:152] Starting API server at: http://localhost:50495
INFO 2013-04-24 00:45:10,700 dispatcher.py:150] Starting server "default" running at: http://localhost:8080
INFO 2013-04-24 00:45:10,706 admin_server.py:117] Starting admin server at: http://localhost:8000
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/mtime_file_watcher.py:82: UserWarning: There are too many files in your application for changes in all of them to be monitored. You may have to restart the development server to see some changes to your files.
'There are too many files in your application for '
ERROR 2013-04-24 00:45:17,489 webapp2.py:1528] app "dev~bandtasticnews" cannot access app "dev~noticiashacker"'s data
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/grillermo/c/BandtasticNews/Noticias-HAcker/handlers/MainHandler.py", line 85, in get
self.response.out.write(template.render('templates/main.html', locals()))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/template.py", line 92, in render
return t.render(Context(template_dict))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/template.py", line 172, in wrap_render
return orig_render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 173, in render
return self._render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 167, in _render
return self.nodelist.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 794, in render
bits.append(self.render_node(node, context))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 807, in render_node
return node.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/loader_tags.py", line 125, in render
return compiled_parent._render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 167, in _render
return self.nodelist.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 794, in render
bits.append(self.render_node(node, context))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 807, in render_node
return node.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/defaulttags.py", line 257, in render
return self.nodelist_true.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 794, in render
bits.append(self.render_node(node, context))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 807, in render_node
return node.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 842, in render
output = self.filter_expression.resolve(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 551, in resolve
obj = self.var.resolve(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 694, in resolve
value = self._resolve_lookup(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 729, in _resolve_lookup
current = current()
File "/Users/grillermo/c/BandtasticNews/Noticias-HAcker/models.py", line 73, in sum_votes
self.put()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 1070, in put
return datastore.Put(self._entity, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 579, in Put
return PutAsync(entities, **kwargs).get_result()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
return self.__get_result_hook(self)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1569, in __put_hook
self.check_rpc_success(rpc)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1224, in check_rpc_success
raise _ToDatastoreError(err)
BadRequestError: app "dev~bandtasticnews" cannot access app "dev~noticiashacker"'s data
INFO 2013-04-24 00:45:17,532 recording.py:673] Saved; key: __appstats__:017200, part: 157 bytes, full: 69853 bytes, overhead: 0.003 + 0.031; link: http://localhost:8080/_ah/stats/details?time=1366764317201
ERROR 2013-04-24 00:45:17,538 cgi.py:121] Traceback (most recent call last):
File "/Users/grillermo/c/BandtasticNews/Noticias-HAcker/main.py", line 91, in <module>
main()
File "/Users/grillermo/c/BandtasticNews/Noticias-HAcker/main.py", line 86, in main
util.run_wsgi_app(application)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/util.py", line 118, in run_bare_wsgi_app
for data in result:
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/appstats/recording.py", line 1284, in appstats_wsgi_wrapper
result = app(environ, appstats_start_response)
File "/Users/grillermo/c/BandtasticNews/Noticias-HAcker/gaesessions/__init__.py", line 451, in __call__
return self.app(environ, my_start_response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/grillermo/c/BandtasticNews/Noticias-HAcker/handlers/MainHandler.py", line 85, in get
self.response.out.write(template.render('templates/main.html', locals()))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/template.py", line 92, in render
return t.render(Context(template_dict))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/template.py", line 172, in wrap_render
return orig_render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 173, in render
return self._render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 167, in _render
return self.nodelist.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 794, in render
bits.append(self.render_node(node, context))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 807, in render_node
return node.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/loader_tags.py", line 125, in render
return compiled_parent._render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 167, in _render
return self.nodelist.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 794, in render
bits.append(self.render_node(node, context))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 807, in render_node
return node.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/defaulttags.py", line 257, in render
return self.nodelist_true.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 794, in render
bits.append(self.render_node(node, context))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 807, in render_node
return node.render(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 842, in render
output = self.filter_expression.resolve(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 551, in resolve
obj = self.var.resolve(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 694, in resolve
value = self._resolve_lookup(context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/_internal/django/template/__init__.py", line 729, in _resolve_lookup
current = current()
File "/Users/grillermo/c/BandtasticNews/Noticias-HAcker/models.py", line 73, in sum_votes
self.put()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 1070, in put
return datastore.Put(self._entity, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 579, in Put
return PutAsync(entities, **kwargs).get_result()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
return self.__get_result_hook(self)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1569, in __put_hook
self.check_rpc_success(rpc)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1224, in check_rpc_success
raise _ToDatastoreError(err)
BadRequestError: app "dev~bandtasticnews" cannot access app "dev~noticiashacker"'s data
UPDATE
Tried it on a different computer and it was the same thing, but this time i tried to run the app without ever having the name noticiashacker on it.
UPDATE
The app.yaml
application: bandtasticnews
version: 5
runtime: python27
api_version: 1
threadsafe: false
libraries:
- name: django
version: "1.3"
builtins:
- appstats: on
- remote_api: on
handlers:
- url: /favicon.ico
static_files: static/favicon.ico
upload: static/favicon.ico
- url: /robots.txt
static_files: static/robots.txt
upload: static/robots.txt
- url: /reports/.*
script: reports.py
login: admin
- url: /tasks/send_top_to_twitter
script: crons.py
login: admin
- url: /tasks/send_to_killmetrics
script: crons.py
login: admin
- url: /tasks/update_top_karma
script: crons.py
login: admin
- url: /tasks/cleanup_sessions
script: crons.py
login: admin
- url: /favicon.ico
static_files: static/favicon.ico
upload: static/favicon.ico
- url: /robots.txt
static_files: static/robots.txt
upload: static/robots.txt
- url: /static
static_dir: static
- url: /admin/.*
script: admin.py
login: admin
- url: .*
script: main.py

Maybe try this, first download your app to a new directory
appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir>
Create a new app.yaml with the app id you want to use (don't copy it but create it new)
then run dev_appserver ./
good luck

You have data from the old appid in the dev datastore.
You need to clear you local datastore with --clear_datastore when you start the dev server. Not sure how you do that in the Launcher (never use it)

Try logging in to admin console,
http://localhost:8888/_ah/admin
while keeping the original name, you can see some data in datastore viewer, clear it off (for all types of entities), stop the dev-server and change the name to new one, and start again. It should work.
The problem is with namespaces, the way google separates data between multiple applications. Some of your data is persisted with old namespace which is not getting deleted.

In my case, simply deleting the cookie solves the problem. I found this solution after that I observed that Chrome incognito mode had no problem with it.

Related

facebookads api calling in google cloud appengine - SSLError: Can't connect to HTTPS URL because the SSL module is not available

I got a requirement to pull the facebookads data into bigquery. I need to create python script for appengine.
Python script standalone is working fine without any issues and got the required data. When I tried to call the same python script from appengine getting the following error.
Please help me with the below error.
Error Message:
ERROR 2017-06-08 21:22:10,816 webapp2.py:1528] Can't connect to HTTPS URL because the SSL module is not available.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Chaitu\Projects\fb\main.py", line 57, in get
stats = ad_account.get_insights(params=params)
File "C:\Chaitu\Projects\fb\facebookads\adobjects\FBAdAccount.py", line 78, in get_insights
return request.execute()
File "C:\Chaitu\Projects\fb\facebookads\api.py", line 653, in execute
cursor.load_next_page()
File "C:\Chaitu\Projects\fb\facebookads\api.py", line 797, in load_next_page
params=self.params,
File "C:\Chaitu\Projects\fb\facebookads\api.py", line 305, in call
timeout=self._session.timeout
File "C:\Chaitu\Projects\fb\requests\sessions.py", line 513, in request
resp = self.send(prep, **send_kwargs)
File "C:\Chaitu\Projects\fb\requests\sessions.py", line 623, in send
r = adapter.send(request, **kwargs)
File "C:\Chaitu\Projects\fb\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
SSLError: Can't connect to HTTPS URL because the SSL module is not available.
ERROR 2017-06-08 21:22:10,822 wsgi.py:279]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 267, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1077, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "C:\Chaitu\Projects\fb\main.py", line 57, in get
stats = ad_account.get_insights(params=params)
File "C:\Chaitu\Projects\fb\facebookads\adobjects\FBAdAccount.py", line 78, in get_insights
return request.execute()
File "C:\Chaitu\Projects\fb\facebookads\api.py", line 653, in execute
cursor.load_next_page()
File "C:\Chaitu\Projects\fb\facebookads\api.py", line 797, in load_next_page
params=self.params,
File "C:\Chaitu\Projects\fb\facebookads\api.py", line 305, in call
timeout=self._session.timeout
File "C:\Chaitu\Projects\fb\requests\sessions.py", line 513, in request
resp = self.send(prep, **send_kwargs)
File "C:\Chaitu\Projects\fb\requests\sessions.py", line 623, in send
r = adapter.send(request, **kwargs)
File "C:\Chaitu\Projects\fb\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
**SSLError: Can't connect to HTTPS URL because the SSL module is not available.**
INFO 2017-06-08 17:22:12,344 module.py:809] default: "GET / HTTP/1.1" 500
AppEngine does support native Python OpenSSL. You need to modify your app.yaml based on which python version you're using.
How to add support for OpenSSL in your AppEngine services is documented here.
For v2.7:
libraries:
- name: ssl
version: 2.7
For v2.7.11:
libraries:
- name: ssl
version: 2.7.11

GAE Endpoints firebase: Authentication Users TypeError: issuers type doesn't match <type 'dict'>

I am following this tutorial for user authentication on GAE, endpoints v2 in Python.
I use their code EXACTLY (only pasting in my app ID).
Running the code locally via PyCharm, it doesn't like the type of "issuers" wanting a dict: TypeError: issuers type doesn't match .
Has it something to do with IDE integration not being supported yet? What am I overlooking?
In full:
ERROR 2017-06-05 15:23:19,417 wsgi.py:263]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "C:\Users(...)\web app\goal.py", line 103, in <module>
issuers=[firebase_issuer])
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\protorpc-1.0\protorpc\util.py", line 173, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\(...)\web app\lib\endpoints\api_config.py", line 976, in api
api_key_required=api_key_required, base_path=base_path)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\protorpc-1.0\protorpc\util.py", line 173, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\(...)\web app\lib\endpoints\api_config.py", line 469, in __init__
base_path=base_path)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\protorpc-1.0\protorpc\util.py", line 173, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\(...)\web app\lib\endpoints\api_config.py", line 550, in __init__
_CheckType(issuers, dict, 'issuers')
File "C:\Users\(...)\web app\lib\endpoints\api_config.py", line 195, in _CheckType
raise TypeError('%s type doesn\'t match %s.' % (name, check_type))
TypeError: issuers type doesn't match <type 'dict'>.
Apologies for the incorrect documentation. You do need to pass a dict. So try issuers={'firebase': firebase_issuer} instead.

Error uploading Google App Engine Application

I am using a normal command to upload my application in Google App Engine (Python 2.7, SDK 1.8.9):
appcfg.py --oauth2 update .
But after a refactoring in my project there is an error in a regular expression for app.yaml (here is the code)
The error is:
02:00 AM Application: sandengine; version: dev
02:00 AM Host: appengine.google.com
02:00 AM Starting update of app: sandengine, version: dev
02:00 AM Getting current resource limits.
02:00 AM Scanning files on local disk.
Traceback (most recent call last):
File "/usr/local/bin/appcfg.py", line 199, in <module>
run_file(__file__, globals())
File "/usr/local/bin/appcfg.py", line 195, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4933, in <module>
main(sys.argv)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4924, in main
result = AppCfgApp(argv).Run()
File "/Applications/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/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4604, in __call__
return method()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 3419, in Update
self._UpdateWithParsedAppYaml(appyaml, self.basepath)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 3466, in _UpdateWithParsedAppYaml
self.UpdateVersion(rpcserver, basepath, appyaml, APP_YAML_FILENAME)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 3357, in UpdateVersion
return appversion.DoUpload(paths, openfunc)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 2143, in DoUpload
self._AddFilesThatAreSmallEnough(paths, openfunc)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 2211, in _AddFilesThatAreSmallEnough
file_classification = FileClassification(self.config, path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 257, in __init__
self.__static_mime_type = self.__GetMimeTypeIfStaticFile(config, filename)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 287, in __GetMimeTypeIfStaticFile
if re.match(regex, filename):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 137, in match
return _compile(pattern, flags).match(string)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: bogus escape: '\\1'
It is a regular expression error, where in upload: you can't use \1 or \2
Here is the fix: https://github.com/coto/gae-boilerplate/commit/7fbcba2cb217f8ccd8ced7bfe634b4aceaf616c6
Instead of "dev" as the version number, try putting in an actual number :)
dev is a reserved keyword. Change the version and instead of dev use a number or a lowercase string.
It Worked for me
Its pretty easy to figure out what file of your app.yaml is the problem by putting a print here.
/home/nburn42/Apps/google_appengine/google/appengine/tools/appcfg.py
line 315
It is maybe a bit overkill but it will definitely get you unstuck.

Getting error 504: Gateway Time-out in dev server

I've been struggling with a 504 error on my python app engine dev server.
I'm behind a corporate proxy but usually have no trouble by setting HTTP_PROXY and HTTPS_PROXY, I don't know if it is related to my problem.
In my code I use discovery from apiclient (main.py line 63)
driveService = discovery.build("drive", "v2", http=http)
When this executes, I get the following traceback
INFO 2013-10-07 13:49:42,812 discovery.py:190] URL being requested: https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=%3A%3A1
ERROR 2013-10-07 13:49:55,848 wsgi.py:262]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 298, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 84, in LoadObject
obj = __import__(path[0])
File "c:\temp\iterlex-backend\main.py", line 63, in <module>
driveService = discovery.build("drive", "v2", http=http)
File "c:\temp\iterlex-backend\oauth2client\util.py", line 132, in positional_wrapper
return wrapped(*args, **kwargs)
File "c:\temp\iterlex-backend\apiclient\discovery.py", line 192, in build
resp, content = http.request(requested_url)
File "c:\temp\iterlex-backend\httplib2\__init__.py", line 1464, in request
cached_value = self.cache.get(cachekey)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", line 559, in get
results = rpc.get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 612, in get_result
return self.__get_result_hook(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", line 615, in __get_hook
rpc.check_success()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 578, in check_success
self.__rpc.CheckSuccess()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in _WaitImpl
self.request, self.response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc.py", line 393, in Send
f = self.opener.open(req)
File "C:\tools\Python27\lib\urllib2.py", line 397, in open
response = meth(req, response)
File "C:\tools\Python27\lib\urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "C:\tools\Python27\lib\urllib2.py", line 435, in error
return self._call_chain(*args)
File "C:\tools\Python27\lib\urllib2.py", line 369, in _call_chain
result = func(*args)
File "C:\tools\Python27\lib\urllib2.py", line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 504: Gateway Time-out
HTTPError()
If I try the offending URL with curl in the same console windows, it works (i have to use the -k option though)
C:\temp> curl -k https://www.googleapis.com/discovery/v1/apis/drive/v2/rest?userIp=%3A%3A1
{
"kind": "discovery#restDescription",
"etag": "\"XflbyoTZtBo225MnsgwJQ-FHlhA/AFnpisGyT0XxOrZz7gMWdR5PpRg\"",
...
Being new to app engine and python, I confess I'm a bit lost, any help would be greatly appreciated
Thanks!
Nicolas

file not accessible: 'templates/test.html' using jinja2 templates in certain directories

A simple GAE application threw the following error on self.jinja2.render_template() on only one computer, but not on any others (both macs and pcs):
ERROR 2012-02-14 21:54:04,987 webapp2.py:1528] [Errno 13] file not accessible: 'templates/test.html'
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/scott/svn/GAE_branches/sample_broken_app/handlers.py", line 21, in get
self.render_response('test.html', **context)
File "/Users/scott/svn/GAE_branches/sample_broken_app/handlers.py", line 14, in render_response
rv = self.jinja2.render_template(_template, **context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2_extras/jinja2.py", line 158, in render_template
return self.environment.get_template(_filename).render(**context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/environment.py", line 719, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/environment.py", line 693, in _load_template
template = self.loader.load(self, name, globals)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/loaders.py", line 115, in load
source, filename, uptodate = self.get_source(environment, name)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/loaders.py", line 165, in get_source
f = open_if_exists(filename)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/utils.py", line 224, in open_if_exists
return open(filename, mode)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 592, in __init__
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: 'templates/test.html'
ERROR 2012-02-14 21:54:04,991 wsgi.py:205]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 193, in Handle
result = handler(self._environ, self._StartResponse)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/scott/svn/GAE_branches/sample_broken_app/handlers.py", line 21, in get
self.render_response('test.html', **context)
File "/Users/scott/svn/GAE_branches/sample_broken_app/handlers.py", line 14, in render_response
rv = self.jinja2.render_template(_template, **context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2_extras/jinja2.py", line 158, in render_template
return self.environment.get_template(_filename).render(**context)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/environment.py", line 719, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/environment.py", line 693, in _load_template
template = self.loader.load(self, name, globals)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/loaders.py", line 115, in load
source, filename, uptodate = self.get_source(environment, name)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/loaders.py", line 165, in get_source
f = open_if_exists(filename)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2/jinja2/utils.py", line 224, in open_if_exists
return open(filename, mode)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 592, in __init__
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: 'templates/test.html'
INFO 2012-02-14 21:54:05,006 dev_appserver.py:2884] "GET /test HTTP/1.1" 500 -
The app is just:
handlers.py:
import webapp2
from webapp2_extras import jinja2
class BaseHandler(webapp2.RequestHandler):
#webapp2.cached_property
def jinja2(self):
# Returns a Jinja2 renderer cached in the app registry.
return jinja2.get_jinja2(app=self.app)
def render_response(self, _template, **context):
# Renders a template and writes the result to the response.
rv = self.jinja2.render_template(_template, **context)
self.response.write(rv)
class MyHandler(BaseHandler):
def get(self):
context = {'message': 'Hello, world!'}
self.render_response('test.html', **context)
webapp2_config = {}
webapp2_config['webapp2_extras.sessions'] = {
'secret_key': 'ef23fsdawe444',
}
application = webapp2.WSGIApplication([
webapp2.Route(r'/test', handler=MyHandler, name='test'),
], debug=True, config=webapp2_config)
app.yaml:
application: sampleapp
version: 0-01
api_version: 1
runtime: python27
threadsafe: false
builtins:
- remote_api: on
handlers:
- url: .*
script: handlers.application
libraries:
- name: jinja2
version: 2.6
- name: webapp2
version: 2.3
There's also a templates directory with test.html in it.
Now when I run the app from a different directory, it works fine.
This google python group post gave me a hint to try a different directory, but I have no idea what's wrong with the original, which ran versions of the code without jinja2 from webapp2_extras fine.
Version info:
OS X 10.6.8,
GoogleAppEngineLauncher: 1.6.2,
Python: 2.7.2
I reinstalled everything, and set my PYTHONPATH to "" in my .bash_profile, but that didn't change anything.
Note: I did strip out a few of the non public directory names from the debug output, but they didn't have spaces or anything.
A few others had a similar error, but their fixes were for older versions. There seems to be something about os.path
root folder and any folder you set in app.yaml as static dir won't work with jinja2 FileSystemLoader
While you're deploying, the value of upload_dir will go into CDN instead of GAE instance, though you're currently in local development server, App Engine SDK prevent you load files from where you couldn't find on production.
I was getting this error of yours, but without using the jinja2 from webapp2_extras (I was creating a jinja_enviroment myself, like
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
). I solved it by ignoring that os.path.dirname(__file__) that is in the docs and just putting
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader('templates'))
So I thought I could help, but tried to solve your problem and nothing came. But when you said
A few others had a similar error, but their fixes were for older
versions. There seems to be something about os.path
what did you mean? Are you using os.path in some part of the code? Because os.path is problematic and webapp2_extras.jinja2 don't use it, it just creates the environment with 'templates' handwritten as the template directory. Check the source.
So, maybe there's a hint somewhere in this comment. Good luck.

Resources