azure.messaging.webpubsubservice.core.rest package

exception azure.messaging.webpubsubservice.core.rest.StreamConsumedError[source]
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception azure.messaging.webpubsubservice.core.rest.ResponseNotReadError[source]
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception azure.messaging.webpubsubservice.core.rest.ResponseClosedError[source]
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
class azure.messaging.webpubsubservice.core.rest.HttpRequest[source]

Represents an HTTP request.

Parameters
  • method (str or HttpVerbs) – HTTP method (GET, HEAD, etc.)

  • url (str) – The url for your request

Keyword Arguments
  • params (mapping or sequence) – Query parameters to be mapped into your URL. Your input should be a mapping or sequence of query name to query value(s).

  • headers (mapping or sequence) – HTTP headers you want in your request. Your input should be a mapping or sequence of header name to header value.

  • json (any) – A JSON serializable object. We handle JSON-serialization for your object, so use this for more complicated data structures than data.

  • content (str or bytes or iterable[bytes] or asynciterable[bytes]) – Content you want in your request body. Think of it as the kwarg you should input if your data doesn’t fit into json, data, or files. Accepts a bytes type, or a generator that yields bytes.

  • data (dict) – Form data you want in your request body. Use for form-encoded data, i.e. HTML forms.

  • files (mapping or sequence) – Files you want to in your request body. Use for uploading files with multipart encoding. Your input should be a mapping or sequence of file name to file content. Use the data kwarg in addition if you want to include non-file data files as part of your request.

Variables
  • url (str) – The URL this request is against.

  • method (str) – The method type of this request.

  • headers (mapping or sequence) – The HTTP headers you passed in to your request

  • content (bytes) – The content passed in for the request

property content

Gets the request content.

property headers
property method
property url
class azure.messaging.webpubsubservice.core.rest.HttpResponse(*, request: azure.messaging.webpubsubservice.core.rest._rest_py3.HttpRequest, **kwargs)[source]
close()None[source]
iter_bytes(chunk_size: int = None) → Iterator[bytes][source]

Iterate over the bytes in the response stream

iter_lines(chunk_size: int = None) → Iterator[str][source]
iter_raw(**_) → Iterator[bytes][source]

Iterate over the raw response bytes

iter_text(chunk_size: int = None) → Iterator[str][source]

Iterate over the response text

json() → Any

Returns the whole body as a json object.

Returns

The JSON deserialized response body

Return type

any

Raises

json.decoder.JSONDecodeError or ValueError (in python 2.7) if object is not JSON decodable

raise_for_status()None

Raises an HttpResponseError if the response has an error status code.

If response is good, does nothing.

read()bytes[source]

Read the response’s bytes.

property content

Returns the response content in bytes

property content_type

Content Type of the response

property encoding

Returns the response encoding. By default, is specified by the response Content-Type header.

property headers

Returns the response headers

property num_bytes_downloaded

See how many bytes of your stream response have been downloaded

property reason

Returns the reason phrase for the response

property request
property status_code

Returns the status code of the response

property text

Returns the response body as a string

property url

Returns the URL that resulted in this response

class azure.messaging.webpubsubservice.core.rest.AsyncHttpResponse(*, request: azure.messaging.webpubsubservice.core.rest._rest_py3.HttpRequest, **kwargs)[source]
async close()None[source]
iter_bytes(chunk_size: int = None) → Iterator[bytes][source]

Iterate over the bytes in the response stream

iter_lines(chunk_size: int = None) → Iterator[str][source]
iter_raw(**_) → Iterator[bytes][source]

Iterate over the raw response bytes

iter_text(chunk_size: int = None) → Iterator[str][source]

Iterate over the response text

json() → Any

Returns the whole body as a json object.

Returns

The JSON deserialized response body

Return type

any

Raises

json.decoder.JSONDecodeError or ValueError (in python 2.7) if object is not JSON decodable

raise_for_status()None

Raises an HttpResponseError if the response has an error status code.

If response is good, does nothing.

async read()bytes[source]

Read the response’s bytes.

property content

Returns the response content in bytes

property content_type

Content Type of the response

property encoding

Returns the response encoding. By default, is specified by the response Content-Type header.

property headers

Returns the response headers

property num_bytes_downloaded

See how many bytes of your stream response have been downloaded

property reason

Returns the reason phrase for the response

property request
property status_code

Returns the status code of the response

property text

Returns the response body as a string

property url

Returns the URL that resulted in this response