Module urllib

Provides methods for making HTTP requests.
The module is to be replaced by a richer net module, also containing sockets.

public members:

NoHTTPRequestObject()

Exception thrown if no request object could be instanciated.

RequestOpenFailed()

Exception thrown if an HTTP request could not be opened.

SendFailed()

Exception thrown if a request could not be sent to the server.

sendRequest(type,url,user,pass,data,headers,callback)

Sends a request to a server.
To explain the way the optional arguments work I will give examples:
simple:
sendRequest("get", "url")
sendRequest("post", "url", "data")

with headers:
sendRequest("get", "url", [["headername","value"]])
sendRequest("post", "url", "data", [["headername","value"]])

with user information:
sendRequest("get", "url", "user", "pass")
sendRequest("post", "url", "user", "pass", "data")

with headers and user information:
sendRequest("get", "url", "user", "pass", [["headername","value"]])
sendRequest("post", "url", "user", "pass", "data", [["headername","value"]])

To make the request asynchronous just add a callback function as the last argument to the calls above.

type Type of connection (GET, POST, ...).
url The URL to retrieve.
user =null The username for auth.
pass =null The password. (must be set if user is set!)
data ="" The data to send with the request.
headers =[] Array of headers. Each element in the array should be another array containing [headername,value].
callback =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.
returns HTTP request object.

getURL(url,user,pass,headers,callback)

Shorthand for a GET request.
It calls sendRequest with "GET" as first argument.
See the sendRequest method for more information.

url The URL to retrieve.
user =null The username for auth.
pass =null The password. (must be set if user is set!)
headers =[] Array of headers. Each element in the array should be another array containing [headername,value].
callback =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.
returns HTTP request object.

postURL(url,user,pass,data,headers, callback)

Shorthand for a POST request.
It calls sendRequest with "POST" as first argument.
See the sendRequest method for more information.

url The URL to retrieve.
user =null The username for auth.
pass =null The password. (must be set if user is set!)
data ="" The data to send with the request.
headers =[] Array of headers. Each element in the array should be another array containing [headername,value].
callback =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.
returns HTTP request object.

requirements

The urllib requires the HTTPRequest object as fond in Mozilla and IE.
In SVG it will use ASV's getURL/postURL methods, but is limited to asynchronous connections.