Class "Network"
Implements the StackExchange APIs client for all SE network.
Note #1: the **kwargs argument in methods is necessary for request parameters, like pagesize, order, etc.
Note #2: The Item class in the get_* methods return type hint is a standard dict class with the ability to get values not only using the d['key'] construction, but also d.key.
Methods:
get
getSignature:
get(self, query: str, **kwargs: Any) -> dictReturns raw result of calling query to API.
get_access_tokens
get_access_tokensSignature:
get_access_tokens(self, access_tokens: Iterable[str], **kwargs: Any) -> list[Item]Returns the properties for a set of access tokens.
invalidate_access_tokens
invalidate_access_tokensSignature:
invalidate_access_tokens(self, access_tokens: Iterable[str],
**kwargs: Any) -> list[Item]Immediately expires the access tokens passed. This method is meant to allow an application to discard any active access tokens it no longer needs. Returns list of access tokens.
get_errors
get_errorsSignature:
get_errors(self, **kwargs: Any) -> list[Item]Returns the various error codes that can be produced by the API.
simulate_error
simulate_errorSignature:
simulate_error(self, code: int, **kwargs: Any) -> NoReturnThis method allows you to generate an error.
create_filter
create_filterSignature:
create_filter(self, **kwargs: Any) -> ItemCreates a new filter given a list of includes, excludes, a base filter, and whether this filter should be "unsafe".
It is not expected that many applications will call this method at runtime, filters should be pre-calculated and "baked in" in the common cases.
get_filters
get_filtersSignature:
get_filters(self, filters: Iterable[str], **kwargs: Any) -> list[Item]Returns the fields included by the given filters, and the "safeness" of those filters.
It is not expected that this method will be consumed by many applications at runtime, it is provided to aid in debugging.
get_sites
get_sitesSignature:
get_sites(self, **kwargs: Any) -> list[Item]Returns all sites in the network.
get_users_associated_accounts
get_users_associated_accountsSignature:
get_users_associated_accounts(self, ids: Iterable[int], **kwargs: Any) -> list[Item]Returns all of a user's associated accounts, given their account ids in ids.
get_users_accounts_merges
get_users_accounts_mergesSignature:
get_users_accounts_merges(self, ids: Iterable[int], **kwargs: Any) -> list[Item]Returns a record of merges that have occurred involving the passed account ids.
Last updated