ovl.connections.http_connection module

class ovl.connections.http_connection.HTTPConnection(session, default_url=None, headers=None, auth=None)[source]

Bases: ovl.connections.connection.Connection

A Connection that utilizes http

HTTP is useful for communicating with HTTP Servers over the web, although slower than other more low level connection types

interval_receive(data: Any, url: str = None, method=<HTTPRequestTypes.GET: 'GET'>, **kwargs)[source]
receive(data: Any = None, url: str = None, method: ovl.connections.http_connection.HTTPRequestTypes = <HTTPRequestTypes.GET: 'GET'>, interval: Union[float, bool] = False, **kwargs)[source]

Receive for HTTPConnection is a bit different compared to other Connection in that it sends a request and returns a response which is the main usage, in addition the interval parameter allows for high interval sampling (for MultiVision for example) without sending many requests

Parameters:
  • url – the url to send to, overrides self.url
  • data – any data to pass with the requests
  • method – determines what http method should the request use (GET, POST, PUT etc.)
  • interval
  • kwargs – any other parameters passed to Request.request
Returns:

send(data: Any, url: str = None, method=<HTTPRequestTypes.POST: 'POST'>, **kwargs)[source]

Sends an http requests, should be used to only send data and not receive any data as it represent the logical action of sending information

Parameters:
  • data – the data to be send, passed
  • url
  • method
  • kwargs
Returns:

send_request(data: Any, url: str, method: ovl.connections.http_connection.HTTPRequestTypes, **kwargs)[source]

send_request is the function used to send a request using http protocol. This can be used to send request to servers running remotely in the internet or to a HTTP server in the LAN.

Note: This is the inner function used by the Connection object to send and receive. The functions send, receive and interval_receive should be used instead!

Parameters:
  • data – The data to be passed as the request’s payload
  • url – the url to send the request to
  • method – the HTTP method to be used
  • kwargs – any other parameters to requests.request
Returns:

the response received for the request

class ovl.connections.http_connection.HTTPRequestTypes[source]

Bases: enum.Enum

An enumeration.

DELETE = 'DELETE'
GET = 'GET'
HEAD = 'HEAD'
PATCH = 'PATCH'
POST = 'POST'
PUT = 'PUT'