0

I have create a pull queue in the GAE that works fine, I'm able to add elements from the app & retrieve them from my instance with the code below:

from apiclient.discovery import build
from oauth2client.client import GoogleCredentials

credentials = GoogleCredentials.get_application_default()
PROJECT_NAME = "my-project"
QUEUE_NAME = 'my-queue'

q = build('taskqueue', 'v1beta2', credentials=credentials)
l = q.tasks().lease(project=PROJECT_NAME, taskqueue=QUEUE_NAME, leaseSecs=600, numTasks=1)
result = l.execute()
task = result['items'][0]
task_id = task['id']

The problem comes when I try to delete the task after processing it, this code that should work

d = q.tasks().delete(project=PROJECT_NAME, taskqueue=QUEUE_NAME, task=task_id)
d.execute()

return

File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting
https://www.googleapis.com/taskqueue/v1beta2/projects/my-project/taskqueues/my-queue/tasks/46101672956060486431?
returned "project name is invalid">

I don't understand what's wrong because I'm able to get a task from the queue, but when I want to delete it, this error is raised.

Does anyone got an insight ?

Albyorix
  • 637
  • 1
  • 6
  • 13
  • Actually, I have the same error doing it directly with REST API here : https://cloud.google.com/appengine/docs/python/taskqueue/rest/tasks/delete I think it might be a bug – Albyorix Sep 04 '16 at 20:27
  • if you're on GAE, isn't it easier to use the taskqueue API from google.appengine.api package? – marcadian Sep 06 '16 at 02:14

1 Answers1

1

Should be "s~my-project" if your app is in North America, or "e~my-project" if in Europe.

GAEfan
  • 11,244
  • 2
  • 17
  • 33