Rest.Proxy

g GObject.Object GObject.Object Rest.Proxy Rest.Proxy GObject.Object->Rest.Proxy

Subclasses:

Rest.OAuth2Proxy

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (url_format, binding_required)

class

new_with_authentication (url_format, binding_required, username, password)

add_soup_feature (feature)

get_user_agent ()

new_call ()

set_user_agent (user_agent)

Virtual Methods

Inherited:

GObject.Object (7)

do_authenticate (auth, retrying)

do_new_call ()

Properties

Name

Type

Flags

Short Description

binding-required

bool

r/w

Whether the URL format requires binding

disable-cookies

bool

r/w/co

Whether to disable cookie support

password

str

r/w

The password for authentication

ssl-ca-file

str

r/w

File containing SSL CA certificates.

ssl-strict

bool

r/w

Whether certificate errors should be considered a connection error

url-format

str

r/w

Format string for the RESTful url

user-agent

str

r/w

The User-Agent of the client

username

str

r/w

The username for authentication

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Rest.Proxy(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Rest.ProxyClass

Rest.Proxy has no publicly available members.

classmethod new(url_format, binding_required)
Parameters:
  • url_format (str) – the endpoint URL

  • binding_required (bool) – whether the URL needs to be bound before calling

Returns:

A new Rest.Proxy.

Return type:

Rest.Proxy

Create a new Rest.Proxy for the specified endpoint url_format, using the “GET” method.

Set binding_required to True if the URL contains string formatting operations (for example “http://foo.com/% s”. These must be expanded using rest_proxy_bind() before invoking the proxy.

classmethod new_with_authentication(url_format, binding_required, username, password)
Parameters:
  • url_format (str) – the endpoint URL

  • binding_required (bool) – whether the URL needs to be bound before calling

  • username (str) – the username provided by the user or client

  • password (str) – the password provided by the user or client

Returns:

A new Rest.Proxy.

Return type:

Rest.Proxy

Create a new Rest.Proxy for the specified endpoint url_format, using the “GET” method.

Set binding_required to True if the URL contains string formatting operations (for example “http://foo.com/% s”. These must be expanded using rest_proxy_bind() before invoking the proxy.

add_soup_feature(feature)
Parameters:

feature (Soup.SessionFeature) – A Soup.SessionFeature

This method can be used to add specific features to the Soup.Session objects that are used by librest for its HTTP connections. For example, if one needs extensive control over the cookies which are used for the REST HTTP communication, it’s possible to get full access to libsoup cookie API by using

RestProxy *proxy = g_object_new(REST_TYPE_PROXY,
                                "url-format", url,
                                "disable-cookies", TRUE,
                                NULL);
SoupSessionFeature *cookie_jar = SOUP_SESSION_FEATURE(soup_cookie_jar_new ());
rest_proxy_add_soup_feature(proxy, cookie_jar);

New in version 0.7.92.

get_user_agent()
Return type:

str

new_call()
Returns:

a new Rest.ProxyCall.

Return type:

Rest.ProxyCall

Create a new Rest.ProxyCall for making a call to the web service. This call is one-shot and should not be re-used for making multiple calls.

set_user_agent(user_agent)
Parameters:

user_agent (str) –

do_authenticate(auth, retrying) virtual
Parameters:
Return type:

bool

do_new_call() virtual
Returns:

a new Rest.ProxyCall.

Return type:

Rest.ProxyCall

Create a new Rest.ProxyCall for making a call to the web service. This call is one-shot and should not be re-used for making multiple calls.

Property Details

Rest.Proxy.props.binding_required
Name:

binding-required

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the URL format requires binding

Rest.Proxy.props.disable_cookies
Name:

disable-cookies

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Whether to disable cookie support

Rest.Proxy.props.password
Name:

password

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The password for authentication

Rest.Proxy.props.ssl_ca_file
Name:

ssl-ca-file

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

File containing SSL CA certificates.

Rest.Proxy.props.ssl_strict
Name:

ssl-strict

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether certificate errors should be considered a connection error

Rest.Proxy.props.url_format
Name:

url-format

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Format string for the RESTful url

Rest.Proxy.props.user_agent
Name:

user-agent

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The User-Agent of the client

Rest.Proxy.props.username
Name:

username

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The username for authentication