maxurl
Make HTTP requests
Description
maxurl is a wrapper around libcurl that can perform HTTP requests. Use it to fetch and post web content. For more information on curl please refer to the Curl Docs Page. To learn about and practice HTTP Requests, check out httpbin.org.
Arguments
thread count[int]
optional
If you would like maxurl to perform HTTP requests in sequence, then set the thread count to 1. If you would like to make multiple requests simultaneously, set the thread count to something greater than one. maxurl will then be able to execute that many requests concurrently. If you start maxurl with 3 threads and tell it to make 5 requests, 3 requests will be started immediately and 2 will be queued to start whenever any of the initial 3 requests finish.
Attributes
Common Box Attributes
annotation[symbol]
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background[int]: 0
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.
color[4 floats]
Sets the color for the object box outline.
fontface[int]
Sets the type style used by the object. The options are:
plain
bold
italic
bold italic
Possible values:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
fontname[symbol]
Sets the object's font.
fontsize[float]
Sets the object's font size (in points).
Possible values:
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'
hint[symbol]
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick[int]: 0
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile[symbol]
JS Painter File
patching_rect[4 floats]: 0. 0. 100. 0.
Sets the position and size of the object in the patcher window.
position[2 floats]
write-only
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation[int]: 0
Sets whether an object belongs to the patcher's presentation.
presentation_rect[4 floats]: 0. 0. 0. 0.
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect[4 floats]
write-only
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size[2 floats]
write-only
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor[4 floats]
Sets the color for the object's text in RGBA format.
textjustification[int]
Sets the justification for the object's text.
Possible values:
0 = 'left'
1 = 'center'
2 = 'right'
varname[symbol]
Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.
Messages
abort
An abort message without any arguments will abort all running requests that this maxurl is performing. Optionally, a list of response dictionary names may be given to abort only those requests. To do the later, you will want to make your request with a specified response dictionary name. See the "response_dict" field of the dictionary message below.
- response dictionary name
[list]
abortall
Aborts all running requests and queued requests.
delete
Sends an HTTP DELETE request to the specified URL.
- url
[list]
dictionary
Dictionary input to perform a more advanced HTTP request.
key name | value |
---|---|
response_dict | (string) sets the response dictionary name |
url | (string) sets the url to which maxurl should make a request. (e.g. "http://cycling74.com" ) |
http_method | (string) one of four options: "get", "post", "put", or "delete" |
post_data |
(string) a url encoded string containing your post variables (e.g. "key1=val1&key2=val2") (dictionary) If post_data is another dictionary, maxurl will encode the dictionary as json data in the post body. |
filename_out | (string) full path name of your output file. If this is set, the "body" key of the response dictionary will be empty. |
filename_in | (string) full path name of your input filen. If this is set, and http_method is "put" or "post", maxurl will read this file as the body of your http request. Use this or the 'multiput_form' field to upload files to a server. |
useragent | (string) the user agent name for your request. Use this to spoof other browsers. By default maxurl declares itself as Firefox on windows. |
timeout | (number) set the timeout length in seconds. NOTE! This will terminate a running connection if it takes longer than the set timeout length. |
connect_timeout | (number) set the timeout length in seconds for making a connection to a remote host. |
parse_type | (string) one of either "none", "json" or "xml". Default is "none". If set to "json" or "xml", maxurl will respectively try to parse the response data into a dict from json or xml data. |
headers | (array of strings) set the request headers directly (e.g ["Content-Type=text/plain; charset=UTF-8", "Server=httpbin"]). |
cookie | (string) cookies are accepted and shared among requests in a maxurl object. However, you may set the request cookie directly here with something like 'name1=value1;name2=value2;' |
http_auth | (string) set the http authentication to be sent with "username:password". By default, maxurl will attempt all authentication methods (basic, digest, gss negotiate, ntlm) |
multipart_form |
(array of dictionaries or dictionary or dictionaries) individual parts should have 2-3 keys, "name", "file", "content", or "contenttype". eg:
|
overwrite_response_dict | (long) Either 0 or 1. If set to 1 (default) maxurl will allow you to make multiple requests that return data in the same response dictionary. If set to 0, maxurl will not allow you to queue your request if there already exists a running or queued request with the same response dictionary. |
overwrite_output_file | (long) Either 0 or 1. By default this is set to 0 and maxurl will not overwite output files. If set to 1, you can force maxurl to overwrite an output file. If there is a running request that is writing data to that filename, it will be aborted. |
proxy | (string) Set a proxy server. |
proxy_type | (string) Either http (default), socks4, socks4a, or socks5 |
proxy_auth | (string) If your proxy requires a password set this to "username:password" |
- name
[symbol]
get
Sends an HTTP GET request to the specified URL.
- url
[list]
post
Sends an HTTP POST request to the specified URL. Any pairs of symbols following the url will be sent as key-value pairs in the url encoded form.
- url
[list]
put
Sends an HTTP PUT request to the specified URL. Any pairs of symbols following the url will be sent as key-value pairs in the url encoded form.
- url
[list]
verbosity
7.0.0
Determines the extent to which the maxurl object posts information about its processes to the Max console. Verbosity ranges from 0 - 6, with 0 disabling all console reporting, 1 being the default and most basic level of verbosity, and 6 being the most verbose.
-
[int]
See Also
Name | Description |
---|---|
jit.net.recv | Receive matrices from a jit.net.send object via TCP/IP |
jit.net.send | Send matrices to a jit.net.recv object via TCP/IP |
jit.uldl | Internet upload/download |
jweb | Web browser |
udpreceive | Receive messages over a network |
udpsend | Send messages over a network |