ocebuild.sources._lib#

Network helper functions.

Module Contents#

Classes#

RequestWrapper

Wrapper for urllib.request.Request to provide a nicer interface.

Functions#

request(→ any)

Simple wrapper over urlopen for skipping SSL verification.

class ocebuild.sources._lib.RequestWrapper(response: any)[source]#

Wrapper for urllib.request.Request to provide a nicer interface.

__enter__() RequestWrapper[source]#
__exit__(*args: object) None[source]#
__getattr__(attr)[source]#
json(*args, **kargs) any[source]#

Return the response as JSON.

text(*args, **kargs) io.TextIOWrapper[source]#

Return the response as text.

ocebuild.sources._lib.request(url: str | urllib.request.Request, *args, **kwargs) any[source]#

Simple wrapper over urlopen for skipping SSL verification.

Parameters:
  • url – The url to open.

  • *args – Additional arguments to pass to urlopen.

  • **kwargs – Additional keyword arguments to pass to urlopen.

Raises:

HTTPError – If the url could not be retrieved.

Returns:

The response from urlopen wrapped in a RequestWrapper class.