xbrl_us package#

Subpackages#

Submodules#

xbrl_us.cli module#

Module that contains the command line app.

Why does this file exist, and why not put this in __main__?

You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice:

  • When you run python -mxbrl_us python will execute __main__.py as a script. That means there will not be any xbrl_us.__main__ in sys.modules.

  • When you import __main__ it will get executed again (as a module) because there”s no xbrl_us.__main__ in sys.modules.

Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration

xbrl_us.cli.main(argv=['/Users/hamid/Downloads/1 TEMP/Research Projects/python-xbrl-us/venv/bin/sphinx-build', 'docs', 'docs/build'])[source]#
Parameters:

argv (list) – List of arguments

Returns:

int – A return code

Does stuff.

xbrl_us.xbrl_us module#

class xbrl_us.xbrl_us.XBRL(client_id: str, client_secret: str, username: str, password: str, grant_type: str = 'password')[source]#

Bases: object

XBRL US API client. Initializes an instance of XBRL authorized connection.

Parameters:
  • client_id (str) – Unique identifier agreed upon by XBRL US and the 3rd party client.

  • client_secret (str) – Base64 key used to authenticate the 3rd party client.

  • username (str) – Unique identifier for a given user.

  • password (str) – Password used to authenticate the 3rd party user.

  • grant_type (str) – Used to identify which credentials the authorization server needs to check

    • client_credentials - Requires a client_id and client_secret only

    • password - Requires a username and password as well as client_id and client_secret

    • default - “password”

static acceptable_params(method_name: str)[source]#
Get the names of the attributes that are allowed to be used for

the given method.

Parameters:

method_name (str) – The name of the API method to get the acceptable parameters for (e.g. “search_fact”).

Returns:

static methods()[source]#
Get the names of the attributes that are allowed to be used for

the given method. A list available methods are:

Method

API Endpoint

assertion search

/api/v1/assertion/search

assertion validate

/api/v1/assertion/validate

concept name search

/api/v1/concept/{concept.local-name}/search

concept search

/api/v1/concept/search

cube search

/api/v1/cube/search

dimension search

/api/v1/dimension/search

document search

/api/v1/document/search

dts id concept label

/api/v1/dts/{dts.id}/concept/{concept.local-name}/label

dts id concept name

/api/v1/dts/{dts.id}/concept/{concept.local-name}

dts id concept reference

/api/v1/dts/{dts.id}/concept/{concept.local-name}/reference

dts id concept search

/api/v1/dts/{dts.id}/concept/search

dts id network

/api/v1/dts/{dts.id}/network

dts id network search

/api/v1/dts/{dts.id}/network/search

dts search

/api/v1/dts/search

entity id

/api/v1/entity/{entity.id}

entity id report search

/api/v1/entity/{entity.id}/report/search

entity report search

/api/v1/entity/report/search

entity search

/api/v1/entity/search

fact id

/api/v1/fact/{fact.id}

fact search

/api/v1/fact/search

fact search oim

/api/v1/fact/oim/search

label dts id search

/api/v1/label/{dts.id}/search

label search

/api/v1/label/search

network id

/api/v1/network/{network.id}

network id relationship search

/api/v1/network/{network.id}/relationship/search

network relationship search

/api/v1/network/relationship/search

relationship search

/api/v1/relationship/search

relationship tree search

/api/v1/relationship/tree/search

report fact search

/api/v1/report/fact/search

report id

/api/v1/report/{report.id}

report id delete

/api/v1/report/{report.id}/delete

report id fact

/api/v1/report/{report.id}/fact/search

report search

/api/v1/report/search

query(method: str, fields: list | None = None, parameters: Parameters | dict | None = None, limit: dict | None = None, sort: dict | None = None, offset: dict | None = None, as_dataframe: bool = False) dict | DataFrame[source]#
Parameters:
  • method (str) – The name of the method to query.

  • fields (list) – The fields query parameter establishes the details of the data to return for the specific query.

  • parameters (dict | Parameters) – The parameters for the query.

  • limit (dict) – A limit restricts the number of results returned by the query. The limit attribute can only be added to an object type and not a property. For example, to limit the number of facts in a query, {“fact”: 10}.

  • sort (dict) – Any returned value can be sorted in ascending or descending order, using ASC or DESC (i.e. {“report.document-type”: “DESC”}. Multiple sort criteria can be defined and the sort sequence is determined by the order of the items in the dictionary.

  • offset – This attribute enables targeting a return to a specific starting point in a query return sequence (i.e. {“report”: 100}. To work reliably, at least one sorted property should be included in the returned fields.

  • as_dataframe (bool=False) – Whether to return the results as a DataFrame or json.

Returns:

dict | DataFrame – The results of the query.

Module contents#

class xbrl_us.XBRL(client_id: str, client_secret: str, username: str, password: str, grant_type: str = 'password')[source]#

Bases: object

XBRL US API client. Initializes an instance of XBRL authorized connection.

Parameters:
  • client_id (str) – Unique identifier agreed upon by XBRL US and the 3rd party client.

  • client_secret (str) – Base64 key used to authenticate the 3rd party client.

  • username (str) – Unique identifier for a given user.

  • password (str) – Password used to authenticate the 3rd party user.

  • grant_type (str) – Used to identify which credentials the authorization server needs to check

    • client_credentials - Requires a client_id and client_secret only

    • password - Requires a username and password as well as client_id and client_secret

    • default - “password”

static acceptable_params(method_name: str)[source]#
Get the names of the attributes that are allowed to be used for

the given method.

Parameters:

method_name (str) – The name of the API method to get the acceptable parameters for (e.g. “search_fact”).

Returns:

static methods()[source]#
Get the names of the attributes that are allowed to be used for

the given method. A list available methods are:

Method

API Endpoint

assertion search

/api/v1/assertion/search

assertion validate

/api/v1/assertion/validate

concept name search

/api/v1/concept/{concept.local-name}/search

concept search

/api/v1/concept/search

cube search

/api/v1/cube/search

dimension search

/api/v1/dimension/search

document search

/api/v1/document/search

dts id concept label

/api/v1/dts/{dts.id}/concept/{concept.local-name}/label

dts id concept name

/api/v1/dts/{dts.id}/concept/{concept.local-name}

dts id concept reference

/api/v1/dts/{dts.id}/concept/{concept.local-name}/reference

dts id concept search

/api/v1/dts/{dts.id}/concept/search

dts id network

/api/v1/dts/{dts.id}/network

dts id network search

/api/v1/dts/{dts.id}/network/search

dts search

/api/v1/dts/search

entity id

/api/v1/entity/{entity.id}

entity id report search

/api/v1/entity/{entity.id}/report/search

entity report search

/api/v1/entity/report/search

entity search

/api/v1/entity/search

fact id

/api/v1/fact/{fact.id}

fact search

/api/v1/fact/search

fact search oim

/api/v1/fact/oim/search

label dts id search

/api/v1/label/{dts.id}/search

label search

/api/v1/label/search

network id

/api/v1/network/{network.id}

network id relationship search

/api/v1/network/{network.id}/relationship/search

network relationship search

/api/v1/network/relationship/search

relationship search

/api/v1/relationship/search

relationship tree search

/api/v1/relationship/tree/search

report fact search

/api/v1/report/fact/search

report id

/api/v1/report/{report.id}

report id delete

/api/v1/report/{report.id}/delete

report id fact

/api/v1/report/{report.id}/fact/search

report search

/api/v1/report/search

query(method: str, fields: list | None = None, parameters: Parameters | dict | None = None, limit: dict | None = None, sort: dict | None = None, offset: dict | None = None, as_dataframe: bool = False) dict | DataFrame[source]#
Parameters:
  • method (str) – The name of the method to query.

  • fields (list) – The fields query parameter establishes the details of the data to return for the specific query.

  • parameters (dict | Parameters) – The parameters for the query.

  • limit (dict) – A limit restricts the number of results returned by the query. The limit attribute can only be added to an object type and not a property. For example, to limit the number of facts in a query, {“fact”: 10}.

  • sort (dict) – Any returned value can be sorted in ascending or descending order, using ASC or DESC (i.e. {“report.document-type”: “DESC”}. Multiple sort criteria can be defined and the sort sequence is determined by the order of the items in the dictionary.

  • offset – This attribute enables targeting a return to a specific starting point in a query return sequence (i.e. {“report”: 100}. To work reliably, at least one sorted property should be included in the returned fields.

  • as_dataframe (bool=False) – Whether to return the results as a DataFrame or json.

Returns:

dict | DataFrame – The results of the query.