# `urequests` — Related functions of HTTP client

Relevant functional functions of the HTTP client, providing various HTTP request methods

## Response class

class urequests.Response(s)

  The Response class object contains the server’s response to the HTTP request.

  ### Methods

  @headers

    Returns the headers.

  @content

    Returns the content of the response, in bytes.

  json()

    Return response json encoded content and convert to dict type.

## Functions

urequests.request(function, url, data=None, json=None, files=None, headers={}, auth=None)

Send an HTTP request to the server.

> - `function` - HTTP function to use

> - `url` - URL to send

> - `data` - To append to the body of the request. If a dictionary or tuple list is provided, the form will be encoded.

> - `json` - json is used to attach to the body of the request.

> - `files` - Used for file upload, the type is 2-tuple, which defines the file name, file path and content type. As follows,{‘name’, (file directory,content-type)}

> - `headers` - Dictionary of headers to send.

> - `auth` - Auth tuple to enable Basic/Digest/Custom HTTP Auth.

urequests.head(url, **kw)

  Send HEAD request and return Response object.

  > - `url` - Request object URL

  > - `**kw` - The parameters of the request function.

urequests.get(url, **kw)

  Send GET request and return Response object.

  > - `url` - Request object URL

  > - `**kw` - Parameters of request function.

urequests.post(url, **kw)

  Send POST request and return Response object.

  > - `url` - Request object URL

  > - `**kw` - Parameters of request function.

urequests.put(url, **kw)

  Send PUT request and return Response object.

  > - `url` - RRequest object URL

  > - `**kw` - Parameters of request function.

urequests.patch(url, **kw)

  Send PATCH request, return Response object.

  > - `url` - Request object URL

  > - `**kw` - Parameters of request function.

urequests.delete(url, **kw)

  Send a DELETE request. Return Response object。

  > - `url` - Request object URL

  > - `**kw` - Parameters of request function.

Language and External Links

Language
  English
  中文

External links
  openmv.io
  forums.openmv.io
  github.com/openmv/openmv
  micropython.org
  forum.micropython.org
  github.com/micropython/micropython