DVIDConnection¶
-
class
DVIDConnection¶ Creates a
libcurlconnection and provides utilities for transferring data between this library and DVID. Each service will callDVIDConnectionindependently and does not need to be accessed very often by the end-user. This class uses a static variable to set the curl context and also sets a curl connection.Warning
It is currently not possible to use a single
DVIDConnectionfor multiple threads. Users should instantiate multiple services to access DVID rather than reusing the same one. This problem will be fixed when the curl connection is given thread-level scope as available in C++11.-
get_addr((DVIDConnection)arg1) → str :¶ Get the address for the DVID connection.
-
get_uri_root((DVIDConnection)arg1) → str :¶ Get the prefix for all DVID API calls
-
make_head_request((DVIDConnection)arg1, (str)endpoint) → int :¶ Simple HEAD requests to DVID. An exception is generated if curl cannot properly connect to the URL.
Parameters: endpoint – endpoint where request is performed Returns: html status code
-
make_request((DVIDConnection)connection, (str)endpoint, (ConnectionMethod)method[, (object)payload=None[, (int)timeout=120[, (long)datasize=1]]]) → tuple :¶ Main helper function retrieving data from DVID. The function performs the action specified in method. An exception is generated if curl cannot properly connect to the URL.
Parameters: - endpoint – endpoint where request is performed
- method –
libdvid.ConnectionMethod, (HEAD,GET,POST,PUT,DELETE) - payload – binary data containing data to be posted
- timeout – timeout for the request (seconds)
- datasize – estimate payload if GET (only useful if there is a resource manager)
Returns: tuple: (status_code, results (bytes), err_msg)
-