コンテンツにスキップ

bamboo.request.http

connect(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the CONNECT method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def connect(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the CONNECT method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.CONNECT,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

delete(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the DELETE method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def delete(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the DELETE method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.DELETE,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

get(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the GET method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def get(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the GET method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.GET,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

head(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the HEAD method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def head(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the HEAD method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.HEAD,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

options(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the OPTIONS method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def options(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the OPTIONS method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.OPTIONS,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

patch(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the PATCH method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def patch(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the PATCH method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.PATCH,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

post(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the POST method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def post(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the POST method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.POST,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

put(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the PUT method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def put(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the PUT method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.PUT,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )

trace(uri, headers={}, body=None, json=None, query={}, timeout=None, blocksize=8192, datacls=<class 'bamboo.api.base.BinaryApiData'>, use_proxy=False, proxy_headers={})

Request with the TRACE method on HTTP.

Parameters:

Name Type Description Default
uri str

URI to be requested.

required
headers t.Dict[str, str]

Request headers.

{}
body t.Optional[bytes]

Request body of bytes.

None
json t.Union[t.Dict[str, t.Any], JsonApiData]

Request body of JSON.

None
query t.Dict[str, t.List[str]]

Query parameters to be attached to the URI.

{}
timeout t.Optional[float]

Seconds waiting for the connection.

None
blocksize int

Block size of sending data.

8192
datacls t.Type[ResponseData_t]

ApiData or its subclass to be attached from the response body.

<class 'bamboo.api.base.BinaryApiData'>
use_proxy t.Union[bool, t.Tuple[str, int]]

Address of a proxy server or whether the connection uses a proxy based on the environment variables.

False
proxy_headers t.Dict[str, str]

Headers to be used on the request to the proxy.

{}

Returns:

Type Description
Response[ResponseData_t]

Response object generated with the response.

Source code in bamboo/request/http.py
def trace(
    uri: str,
    headers: t.Dict[str, str] = {},
    body: t.Optional[bytes] = None,
    json: t.Union[t.Dict[str, t.Any], JsonApiData] = None,
    query: t.Dict[str, t.List[str]] = {},
    timeout: t.Optional[float] = None,
    blocksize: int = 8192,
    datacls: t.Type[ResponseData_t] = BinaryApiData,
    use_proxy: t.Union[bool, t.Tuple[str, int]] = False,
    proxy_headers: t.Dict[str, str] = {},
) -> Response[ResponseData_t]:
    """Request with the TRACE method on HTTP.

    Args:
        uri: URI to be requested.
        headers: Request headers.
        body: Request body of bytes.
        json: Request body of JSON.
        query: Query parameters to be attached to the URI.
        timeout: Seconds waiting for the connection.
        blocksize: Block size of sending data.
        datacls: `ApiData` or its subclass to be attached from the response body.
        use_proxy: Address of a proxy server or whether the connection
            uses a proxy based on the environment variables.
        proxy_headers: Headers to be used on the request to the proxy.

    Returns:
        Response object generated with the response.
    """
    return request(
        uri,
        HTTPMethods.TRACE,
        headers=headers,
        body=body,
        json=json,
        query=query,
        timeout=timeout,
        blocksize=blocksize,
        datacls=datacls,
        use_proxy=use_proxy,
        proxy_headers=proxy_headers,
    )
Back to top