This part of the documentation covers all the interfaces of odbrasil.
Note
odbrasil usually returns the data extracted as a Pandas DataFrame, to get a better introduction on how to use it, see Pandas documentation.
This module implements the methods to extract the information present on on the government site for open data: http://www2.camara.gov.br/transparencia/dados-abertos
Bases: odbrasil.legislativo.camara.RESTServiceClient
This class is responsible by accessing, extracting and parsing the data from the Deputados government endpoint.
This method will get a Deputados list in various formats, use the format parameter to define which parameter you want to parse the data.
Parameters: |
|
---|---|
Return type: | the parsed xml or the pandas DataFrame. |
Bases: odbrasil.legislativo.camara.RESTServiceClient
This class is responsible by accessing, extracting and parsing the data from the Orgaos government endpoint.
This method will get a Orgaos list in various formats, use the format parameter to define which parameter you want to parse the data.
Parameters: |
|
---|---|
Return type: | the parsed xml or the pandas DataFrame. |
This method will get a list of ‘Tipos de Orgaos’. Use the format parameter to define which parameter you want to parse the data.
Parameters: |
|
---|---|
Return type: | the parsed xml or the pandas DataFrame. |
Bases: object
The base class used by other subclasses to retrieve data from the government webservices. If you want to subclass this class, you have to define two class variables on your subclass, called base_url and the expected content_type. See Deputados for reference.
This class is responsible for keeping the common functionality used by the service clients, like using the User-Agent as odbrasil/1.0 for instance.
Note
you shouldn’t use this RESTServiceClient on your application except if you really need to customize the internals of the REST client.
This method uses the baseurl parameter and concats the service parameter into it to create the request URL. Any extra param passed to this method by the params parameter will be redirected to the Requests request.
Parameters: |
|
---|---|
Return type: | the Requests request response |
Method used to parse a xml parsed list of deputado elements into a pandas DataFrame.
Parameters: | xml_deputado_list – the xml parsed data returned by calling Deputados.get_deputados() with the format as ‘xml’ instead of ‘pandas’. |
---|---|
Return type: | pandas ‘DataFrame’ |
This method converts a list of xml elements containing only attributes (without childs) to a pandas DatFrame.
Parameters: | xml_list – |
---|---|
Return type: | pandas DataFrame |
This module implements the methods to extract the information present on on the government site for open data: http://www.portaldatransparencia.gov.br/servidores/index.asp
Note
The methods present in this module are intended to do web scraping of the data from the “Portal da Transparencia”, since the government doesn’t provide n decent REST API for that service yet.
This function will load the IdServidor parameter from the government site, it will use scraping methods and not a REST API to do that. The name parameter must be unique, otherwise an exception will be raised.
Parameters: | name – The servidor name |
---|---|
Return type: | The id of the servidor on the government database |
This function will load the month payment for the ‘Servidor’, it will use scraping methods and not a REST API to do that.
Parameters: | servidor_id – The servidor id, returned by get_servidor_id() |
---|---|
Return type: | The month payment of that ‘Servidor’ |