I have this code that works fine:
taskqueue.add(url = MY_URL, params={'id': 42}, queue_name='random-message')
In this official document it says: "Adds a task or list of tasks into this queue."
But I can't understand how.
I already tried this:
tasks = []
tasks.append(taskqueue.Task(url = MY_URL, params={'id': 42}))
taskqueue.add(tasks, queue_name='random-message')
but It raises an error that I don't understand:
'Task payloads must be strings; invalid payload: %r' % payload)
I tried many others little variants that weren't working anyway.
The problem was:
taskqueue.add(task)
It cannot receive more than one task at a time. The right way to do that is this:
taskqueue.Queue.add(tasks)
My code is now working:
tasks = []
tasks.append(taskqueue.Task(url = MY_URL, params={'id': 42}))
taskqueue.Queue('random-message').add(tasks)