pynssp.core package
Submodules
pynssp.core.constants module
pynssp.core.container module
- class pynssp.core.container.APIGraph(path, response)[source]
Bases:
object
A class to store an API graph
- Parameters:
path – a string representing the location of a graph
response – an object of class response
- Variables:
path – the location of a graph file
response – a response object
- class pynssp.core.container.NSSPContainer(value)[source]
Bases:
object
A NSSPContainer Class to store a value or an object
An object of class NSSPContainer stores a value or an object The NSSPContainer class encapsulates a value or an object
- Parameters:
value – value to store
- Variables:
value – Stored value
- Examples:
>>> from pynssp import NSSPContainer >>> >>> cont = NSSPContainer("abcdef")
pynssp.core.credentials module
- class pynssp.core.credentials.Credentials(username=None, password=None)[source]
Bases:
object
A Token Class Representing a Credentials object
A Credentials object has a username, a password and a key. A Credentials object gets API data via an API URL.
- Parameters:
username – a string for username (Default username = None)
password – a string for password (Default password = None)
- Examples:
>>> from pynssp import Credentials >>> >>> myProfile = Credentials("user", "pass")
- get_api_data(url, fromCSV=False, encoding='utf-8', **kwargs)[source]
Get API data
- Parameters:
url – a string of API URL
fromCSV – a logical, defines whether data are received in .csv format or .json format (Default value = False)
encoding – an encoding standard (Default value = “utf-8”)
**kwargs –
Additional keyword arguments to pass to pandas.read_csv() if fromCSV is True.
- Returns:
A pandas dataframe
- get_api_graph(url, file_ext='.png')[source]
Get API graph
- Parameters:
url – a string of API URL
file_ext – a non-empty character vector giving the file extension. (Default value = “.png”)
- Returns:
an object of type APIGraph
pynssp.core.token module
- class pynssp.core.token.Token(token, access_token='Bearer')[source]
Bases:
object
A Token Class Representing a Token object
A Token object has a token string and a key. A Token object can get API data via an API URL.
- Parameters:
token – a token string
access_token – type of HTTP authentication. Should be “Bearer” or “Basic”. (Default value = “Bearer”)
- Variables:
access_token – HTTP authentication type.
- Examples:
>>> from pynssp import Token >>> >>> myTokenProfile = Token("abc123")
- get_api_data(url, fromCSV=False, encoding='utf-8', **kwargs)[source]
Get API data
- Parameters:
url – a string of API URL
fromCSV – a logical, defines whether data are received in .csv format or .json format (Default value = False)
encoding – an encoding standard (Default value = “utf-8”)
**kwargs –
Additional keyword arguments to pass to pandas.read_csv() if fromCSV is True.
- Returns:
A pandas dataframe
- get_api_graph(url, file_ext='.png')[source]
Get API graph
- Parameters:
url – a string of API URL
file_ext – a non-empty character vector giving the file extension. (Default value = “.png”)
- Returns:
an object of type APIGraph