python-gcm icon indicating copy to clipboard operation
python-gcm copied to clipboard

Permission denied error while using send_topic_message() in a GAE environment

Open rainbowbreeze opened this issue 9 years ago • 0 comments

Hi,

I tried to use your library inside a Google App Engine Python enviroment, without success. When I run the code in the file https://github.com/geeknam/python-gcm/blob/master/examples/topic_messaging.py using plain python, it runs without problems, but when I copy/paste the same code in a GAE app, I obtain the following error (please note that I changed the api key in the logs, but I'm using a good one in my tests).

I know there are lot in contextual info missing, I'm available to provide them, but maybe just with this log you can have some clues of what's happening and why.

Thanks!


2016-04-03 13:44:25,295 - DEBUG - gcm.py:242 - log()] Added a stderr logging handler to logger: gcm.gcm [2016-04-03 13:44:25,305 - DEBUG - gcm.py:242 - log()] Added a stderr logging handler to logger: requests.packages.urllib3 [2016-04-03 13:44:25,316 - DEBUG - gcm.py:242 - log()] Request URL: https://gcm-http.googleapis.com/gcm/send [2016-04-03 13:44:25,320 - DEBUG - gcm.py:242 - log()] Request headers: {'Content-Type': 'application/json', 'Authorization': 'key=XXXXXXXXXXXXX'} [2016-04-03 13:44:25,331 - DEBUG - gcm.py:242 - log()] Request proxy: None [2016-04-03 13:44:25,343 - DEBUG - gcm.py:242 - log()] Request timeout: None [2016-04-03 13:44:25,346 - DEBUG - gcm.py:242 - log()] Request data: {"data": {"param2": "value2", "param1": "value1"}, "to": "/topics/SomeTopic"} [2016-04-03 13:44:25,349 - DEBUG - gcm.py:242 - log()] Request is_json: True [2016-04-03 13:44:25,372 - INFO - connectionpool.py:758 - _new_conn()] Starting new HTTPS connection (1): gcm-http.googleapis.com INFO 2016-04-03 13:44:25,372 connectionpool.py:758] Starting new HTTPS connection (1): gcm-http.googleapis.com ERROR 2016-04-03 13:44:25,592 app.py:1423] Exception on /gcm [GET] Traceback (most recent call last): File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/flask_restful/init.py", line 271, in error_router return original_handler(e) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/flask/app.py", line 1461, in dispatch_request return self.view_functionsrule.endpoint File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/main.py", line 32, in gcm_python_gcm response = gcm.send_topic_message(topic=topic, data=data) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/gcm/gcm.py", line 549, in send_topic_message response = self.make_request(payload, is_json=True, session=session) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/gcm/gcm.py", line 308, in make_request proxies=self.proxy, timeout=self.timeout, File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/requests/sessions.py", line 511, in post return self.request('POST', url, data=data, json=json, *_kwargs) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/requests/sessions.py", line 468, in request resp = self.send(prep, *_send_kwargs) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/requests/sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "/Users/alfredomorresi/Documents/develop/repositories/directwire/master/backend/gae/lib/requests/adapters.py", line 426, in send raise ConnectionError(err, request=request) ConnectionError: ('Connection aborted.', error(13, 'Permission denied')) INFO 2016-04-03 13:44:25,598 module.py:787] default: "GET /gcm HTTP/1.1" 500 80

rainbowbreeze avatar Apr 03 '16 14:04 rainbowbreeze