This document describes Celery 2.4. For development docs, go here.
celery.task.http¶
celery.task.http¶
Task webhooks implementation.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
-
class
celery.task.http.
HttpDispatch
(url, method, task_kwargs, logger)¶ Make task HTTP request and collect the task result.
Parameters: - url – The URL to request.
- method – HTTP method used. Currently supported methods are GET and POST.
- task_kwargs – Task keyword arguments.
- logger – Logger used for user/system feedback.
-
dispatch
()¶ Dispatch callback and return result.
-
http_headers
¶
-
make_request
(url, method, params)¶ Makes an HTTP request and returns the response.
-
timeout
= 5¶
-
user_agent
= 'celery/2.4.7'¶
-
class
celery.task.http.
HttpDispatchTask
¶ Task dispatching to an URL.
Parameters: - url – The URL location of the HTTP callback task.
- method – Method to use when dispatching the callback. Usually GET or POST.
- **kwargs – Keyword arguments to pass on to the HTTP callback.
-
url
¶ If this is set, this is used as the default URL for requests. Default is to require the user of the task to supply the url as an argument, as this attribute is intended for subclasses.
-
method
¶ If this is set, this is the default method used for requests. Default is to require the user of the task to supply the method as an argument, as this attribute is intended for subclasses.
-
method
= None
-
name
= 'celery.task.http.HttpDispatchTask'¶
-
run
(url=None, method='GET', **kwargs)¶
-
url
= None
-
exception
celery.task.http.
InvalidResponseError
¶ The remote server gave an invalid response.
-
class
celery.task.http.
MutableURL
(url)¶ Object wrapping a Uniform Resource Locator.
Supports editing the query parameter list. You can convert the object back to a string, the query will be properly urlencoded.
Examples
>>> url = URL("http://www.google.com:6580/foo/bar?x=3&y=4#foo") >>> url.query {'x': '3', 'y': '4'} >>> str(url) 'http://www.google.com:6580/foo/bar?y=4&x=3#foo' >>> url.query["x"] = 10 >>> url.query.update({"George": "Costanza"}) >>> str(url) 'http://www.google.com:6580/foo/bar?y=4&x=10&George=Costanza#foo'
-
exception
celery.task.http.
RemoteExecuteError
¶ The remote task gave a custom error.
-
class
celery.task.http.
URL
(url, dispatcher=None)¶ HTTP Callback URL
Supports requesting an URL asynchronously.
Parameters: - url – URL to request.
- dispatcher – Class used to dispatch the request.
By default this is
HttpDispatchTask
.
-
dispatcher
¶ alias of
HttpDispatchTask
-
get_async
(**kwargs)¶
-
post_async
(**kwargs)¶
-
exception
celery.task.http.
UnknownStatusError
¶ The remote server gave an unknown status.
-
celery.task.http.
extract_response
(raw_response)¶ Extract the response text from a raw JSON response.
-
celery.task.http.
maybe_utf8
(value)¶ Encode to utf-8, only if the value is Unicode.
-
celery.task.http.
utf8dict
(tup)¶ With a dict’s items() tuple return a new dict with any utf-8 keys/values encoded.