simple_salesforce.util module

Utility functions for simple-salesforce

class simple_salesforce.util.PerAppUsage(used, total, name)[source]

Bases: NamedTuple

Per App Usage information for a Salesforce org

name: str

Alias for field number 2

total: int

Alias for field number 1

used: int

Alias for field number 0

class simple_salesforce.util.Usage(used, total)[source]

Bases: NamedTuple

Usage information for a Salesforce org

total: int

Alias for field number 1

used: int

Alias for field number 0

simple_salesforce.util.call_salesforce(url, method, session, headers, **kwargs)[source]

Utility method for performing HTTP call to Salesforce.

Returns a requests.result object.

Return type:

Response

simple_salesforce.util.date_to_iso8601(date)[source]

Returns an ISO8601 string from a date

Return type:

str

simple_salesforce.util.exception_handler(result, name='')[source]

Exception router. Determines which error to raise for bad results

Return type:

NoReturn

simple_salesforce.util.getUniqueElementValueFromXmlString(xmlString, elementName)[source]

Extracts an element value from an XML string.

For example, invoking getUniqueElementValueFromXmlString(

‘<?xml version=”1.0” encoding=”UTF-8”?><foo>bar</foo>’, ‘foo’)

should return the value ‘bar’.

Return type:

Optional[str]

simple_salesforce.util.list_from_generator(generator_function)[source]

Utility method for constructing a list from a generator function

Return type:

List[T]

simple_salesforce.util.safe_urljoin(base, path)[source]

Join path onto base, refusing any result outside base.

urljoin discards base when path is an absolute URL or a network-path reference (//host), and resolves .. segments. A caller-supplied record Id could otherwise send an authenticated request, including its bearer token, to an arbitrary host.

Return type:

str