IHEWAcollect.base package¶
Submodules¶
IHEWAcollect.base.base module¶
Base
Examples:
from IHEWAcollect.base import Base
base = Base(product='CFSR', is_print=True)
- class IHEWAcollect.base.base.Base(product, is_print)[source]¶
Bases:
object
This Base class
Load base.yml file.
- Parameters:
- classmethod check_conf(key, is_print) dict [source]¶
Check configuration information
This is the function to get user’s configuration data.
Don’t synchronize the details to github.
File to read:
collect.yml
.
- get_conf(key) dict [source]¶
Get configuration information
This is the function to get project’s configuration data.
- get_status() str [source]¶
Get status
This is the function to get project status.
- Returns:
Status message.
- Return type:
- status = 'Global status.'¶
IHEWAcollect.base.exception module¶
Exception
https://julien.danjou.info/python-exceptions-guide/
- exception IHEWAcollect.base.exception.IHEClassInitError(mod, msg=None)[source]¶
Bases:
Exception
IHEClassInitError Class
- exception IHEWAcollect.base.exception.IHEFileError(file, msg=None)[source]¶
Bases:
Exception
IHEFileError Class
- exception IHEWAcollect.base.exception.IHEKeyError(key, val, msg=None)[source]¶
Bases:
Exception
IHEKeyError Class
- exception IHEWAcollect.base.exception.IHEPassError(vname, msg=None)[source]¶
Bases:
Exception
IHEPassError Class
IHEWAcollect.base.user module¶
User
Before use this module, set account information in the accounts.yml
file.
Examples:
from IHEWAcollect.base.user import User
user = User(workspace=path, product='CFSR', is_print=True)
Note
Create
accounts.yml
under root folder of the project, based on theconfig-example.yml
.Run
User.credential.encrypt_cfg(path, file, password)
to generateaccounts.yml-encrypted
file.Save key to
credential.yml
.
- class IHEWAcollect.base.user.User(workspace, product, is_print, **kwargs)[source]¶
Bases:
Base
This User class
Description
- Parameters:
- get_user(key)[source]¶
Get user information
This is the function to get user’s configuration data.
Don’t synchronize the details to github.
File to read:
accounts.yml-credential
contains key:accounts.yml-encrypted
.File to read:
accounts.yml-encrypted
generated from:accounts.yml
.
- Parameters:
key (str) – Key name.
- Returns:
User data.
- Return type:
- Example:
>>> import os >>> from IHEWAcollect.base.user import User >>> user = User(os.getcwd(), 'FTP_WA_GUESS', is_print=False) >>> account = user.get_user('account') >>> account['FTP_WA_GUESS'] {'username': 'wateraccountingguest', 'password': 'W@t3r@ccounting', ... >>> accounts = user.get_user('accounts') Traceback (most recent call last): ... KeyError:
- status = 'Global status.'¶
Module contents¶
IHEWAcollect base modules