0

I am using Google Endpoint in Python. Now I want to add a push queue but I do not want anyone has the right to trigger this queue. For example, I create a queue when user call one api.

endpoints.method(..,path='conference',http_method='POST',name='createConference') def createConference(self, request): ... taskqueue.add(url="/task/sendEmail", params={"conference": conference}) ... Now, how can I define the handler for this queue and nobody can call it by api? I got stuck here several days, please give me some hints for guiding me to be out here. Thanks

YungChun
  • 105
  • 5

1 Answers1

0

Your Endpoints method can be protected by restricting the users that can call the API

endpoints.get_current_user()

For restricting direct call to push-queue, Google's Push Queue doc says, "You can prevent users from accessing URLs of tasks by restricting access to administrator accounts. Task queues can access admin-only URLs. You can restrict a URL by adding login: admin to the handler configuration in app.yaml."

app.yaml snippet

handlers:
- url: /tasks/process
  script: process.app
  login: admin
Ashish Awasthi
  • 1,302
  • 11
  • 23
  • Thanks. One more question, how can I define a handler which can respond to the url defined in taskqueue? – YungChun Jul 22 '14 at 15:41
  • I found one solution for above question by using "webapp2". [link](https://developers.google.com/appengine/docs/python/taskqueue/overview-push). But I still can not find solution by just using "endpoint" – YungChun Jul 22 '14 at 15:58
  • what do you mean by "respond to the url defined in taskqueue"? – Ashish Awasthi Jul 23 '14 at 01:35
  • If your original question is answered, I'd suggest you should mark this one 'accepted' and start a new thread for the new one. That will help people looking for your original question here and those looking for the new one at the new thread. – Ashish Awasthi Jul 23 '14 at 01:37