Client module documentation

This module provides acces to the API of a foreman server

class foreman.client.Foreman(url, auth=None, version=None, api_version=None, use_cache=True)[source]

Main client class. It’s methods will be autogenerated, check the API docs for your foreman version here.

do_delete(url, kwargs)[source]
Parameters:
  • url – relative url to resource
  • kwargs – parameters for the api call
do_get(url, kwargs)[source]
Parameters:
  • url – relative url to resource
  • kwargs – parameters for the api call
do_post(url, kwargs)[source]
Parameters:
  • url – relative url to resource
  • kwargs – parameters for the api call
do_put(url, kwargs)[source]
Parameters:
  • url – relative url to resource
  • kwargs – parameters for the api call
get_foreman_version()[source]

Even if we have an api method that return the foreman version, we need the version first to know it’s path, so instead of that we get the main page and extract the version from the footer.

exception foreman.client.ForemanException(res, msg)[source]
exception foreman.client.ForemanVersionException[source]
class foreman.client.MetaForeman[source]
classmethod convert_plugin_def(meta, mname, funcs)[source]

This function parses one of the elements of the definitions dict for a plugin and extracts the relevant information :param meta: This meta class :param mname: HTTP method that uses (GET, POST, DELETE, ...) :param funcs: functions related to that HTTP method

exception foreman.client.ObjectNotFound(res, msg)[source]
class foreman.client.Resource(foreman)[source]

Provides entry point for specific resource.

class foreman.client.ResourceMeta[source]

This type composes methods for resource class

classmethod create_func(meta, definition, api)[source]

Generate function for specific method and using specific api :param definition: dict contains definition of function :param api: dict contains api URL

classmethod create_param_doc(meta, param, prefix=None)[source]

Generate documentation for single parameter of function :param param: dict contains info about parameter :param sub: prefix string for recursive purposes

exclude_html_reg = <_sre.SRE_Pattern object at 0x40ce930>
multi_api_reg = <_sre.SRE_Pattern object at 0x2f02670>
params_reg = <_sre.SRE_Pattern object at 0x40f7c00>
exception foreman.client.Unacceptable(res, msg)[source]
foreman.client.res_to_str(res)[source]
Parameters:resrequests.Response object

Parse the given request and generate an informative string from it

foreman.client.ver_cmp(ver_a, ver_b)[source]

Previous topic

Welcome to Python Foreman’s documentation!

Next topic

Tutorial

This Page