App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Public Attributes | List of all members
google.appengine.api.taskqueue.taskqueue.Task Class Reference
Inheritance diagram for google.appengine.api.taskqueue.taskqueue.Task:

Public Member Functions

def __init__
 
def eta_posix
 
def eta
 
def headers
 
def method
 
def name
 
def on_queue_url
 
def payload
 
def queue_name
 
def retry_count
 
def retry_options
 
def size
 
def tag
 
def target
 
def url
 
def was_enqueued
 
def was_deleted
 
def add_async
 
def add
 
def extract_params
 
def __repr__
 

Public Attributes

 method
 

Detailed Description

Represents a single Task on a queue.

Constructor & Destructor Documentation

def google.appengine.api.taskqueue.taskqueue.Task.__init__ (   self,
  payload = None,
  kwargs 
)
Initializer.

All parameters are optional.

Args:
  payload: The payload data for this Task that will either be delivered
to the webhook as the HTTP request body or fetched by workers for pull
queues. This is only allowed for POST, PUT and PULL methods.
  name: Name to give the Task; if not specified, a name will be
auto-generated when added to a queue and assigned to this object. Must
match the _TASK_NAME_PATTERN regular expression.
  method: Method to use when accessing the webhook. Defaults to 'POST'. If
set to 'PULL', task will not be automatically delivered to the webhook,
instead it stays in the queue until leased.
  url: Relative URL where the webhook that should handle this task is
located for this application. May have a query string unless this is
a POST method. Must not be specified if method is PULL.
  headers: Dictionary of headers to pass to the webhook. Values in the
dictionary may be iterable to indicate repeated header fields. Must not
be specified if method is PULL.
  params: Dictionary of parameters to use for Task. For POST and PULL
requests these params will be encoded as
'application/x-www-form-urlencoded' and set to the payload. For all
other methods, the parameters will be converted to a query string. Must
not be specified if the URL already contains a query string, or the
task already has payload.
  countdown: Time in seconds into the future that this Task should execute.
Defaults to zero.
  eta: A datetime.datetime specifying the absolute time at which the task
should be executed. Must not be specified if 'countdown' is specified.
This may be timezone-aware or timezone-naive. If None, defaults to now.
For pull tasks, no worker will be able to lease this task before the
time indicated by eta.
  retry_options: TaskRetryOptions used to control when the task will be
retried if it fails.
  target: The alternate version/backend on which to execute this task, or
DEFAULT_APP_VERSION to execute on the application's default version.
  tag: The tag to be used when grouping by tag (PULL tasks only).

Raises:
  InvalidEtaError: if the ETA is too far into the future;
  InvalidTagError: if the tag is too long;
  InvalidTaskError: if any of the parameters are invalid;
  InvalidTaskNameError: if the task name is invalid;
  InvalidUrlError: if the task URL is invalid or too long;
  TaskTooLargeError: if the task with its payload is too large.

Member Function Documentation

def google.appengine.api.taskqueue.taskqueue.Task.add (   self,
  queue_name = _DEFAULT_QUEUE,
  transactional = False 
)
Adds this Task to a queue. See Queue.add.
def google.appengine.api.taskqueue.taskqueue.Task.add_async (   self,
  queue_name = _DEFAULT_QUEUE,
  transactional = False,
  rpc = None 
)
Asynchronously adds this Task to a queue. See Queue.add_async.
def google.appengine.api.taskqueue.taskqueue.Task.eta (   self)
Returns a datetime when this Task will execute.
def google.appengine.api.taskqueue.taskqueue.Task.eta_posix (   self)
Returns a POSIX timestamp giving when this Task will execute.
def google.appengine.api.taskqueue.taskqueue.Task.extract_params (   self)
Returns the parameters for this task.

Returns:
  A dictionary of strings mapping parameter names to their values as
  strings. If the same name parameter has several values then the value will
  be a list of strings. For POST and PULL requests then the parameters are
  extracted from the task payload. For all other methods, the parameters are
  extracted from the url query string. An empty dictionary is returned if
  the task contains an empty payload or query string.

Raises:
  ValueError: if the payload does not contain valid
'application/x-www-form-urlencoded' data (for POST and PULL) or the url
does not contain a valid query (all other methods).
def google.appengine.api.taskqueue.taskqueue.Task.headers (   self)
Returns a copy of the headers for this Task.
def google.appengine.api.taskqueue.taskqueue.Task.method (   self)
Returns the method to use for this Task.
def google.appengine.api.taskqueue.taskqueue.Task.name (   self)
Returns the name of this Task.

Will be None if using auto-assigned Task names and this Task has not yet
been added to a Queue.
def google.appengine.api.taskqueue.taskqueue.Task.on_queue_url (   self)
Returns True if this Task will run on the queue's URL.
def google.appengine.api.taskqueue.taskqueue.Task.payload (   self)
Returns the payload for this task, which may be None.
def google.appengine.api.taskqueue.taskqueue.Task.queue_name (   self)
Returns the name of the queue this Task is associated with.

Will be None if this Task has not yet been added to a queue.
def google.appengine.api.taskqueue.taskqueue.Task.retry_count (   self)
Returns the number of retries have been done on the task.
def google.appengine.api.taskqueue.taskqueue.Task.retry_options (   self)
Returns the TaskRetryOptions for this task, which may be None.
def google.appengine.api.taskqueue.taskqueue.Task.size (   self)
Returns the size of this task in bytes.
def google.appengine.api.taskqueue.taskqueue.Task.tag (   self)
Returns the tag for this Task.
def google.appengine.api.taskqueue.taskqueue.Task.target (   self)
Returns the target for this Task.
def google.appengine.api.taskqueue.taskqueue.Task.url (   self)
Returns the relative URL for this Task.
def google.appengine.api.taskqueue.taskqueue.Task.was_deleted (   self)
Returns True if this Task has been successfully deleted.
def google.appengine.api.taskqueue.taskqueue.Task.was_enqueued (   self)
Returns True if this Task has been enqueued.

Note: This will not check if this task already exists in the queue.

The documentation for this class was generated from the following file: