Python Command: Login

Use the Login commands in Python to retrieve information specific to the current GainSeeker User. This information can be edited on the Users tab of the Administration module.

See Python commands for other commands you can use with GainSeeker.

 

Contents  [Hide]

 

Login command table

Syntax

Example

Description/Remarks

login.computeruser

login.computeruser

Returns the name of the currently logged in Windows user.

login.configid

login.configid

Returns the internal number of the GainSeeker configuration used by the currently logged in GainSeeker user.

login.emailaddress

login.emailaddress

Returns the email address of the currently logged in GainSeeker user.  The email address can be edited on the Users tab of the Administration module.

login.emailpassword

login.emailpassword

Returns the email password of the currently logged in GainSeeker user.  The email password can be edited on the Users tab of the Administration module.

login.emailport

login.emailport

Returns the email port number for the GainSeeker system. The email port number can be edited on the Configurations tab of the Administration module in the System-wide settings branch.

login.emailserver

login.emailserver

Returns the name of the email server for the GainSeeker system.  The email server name can be edited on the Configurations tab of the Administration module in the System-wide settings branch.

login.emailusername

login.emailusername

Returns the email user name of the currently logged in GainSeeker user.  The email user name can be edited on the Users tab of the Administration module.

login.roleid

login.roleid

Returns the internal number of the GainSeeker Role used by the currently logged in GainSeeker user.

login.userid

login.userid

Returns the internal number of the currently logged in GainSeeker user.

login.username

login.username

Returns the name of the currently logged in GainSeeker user.

Example

This example comes from the online Hertzler Systems Python Design Library and is available for download. This example is just a portion of a larger script and will not execute without the entire script. This is an example of using the Python login commands to set email properties instead of hard coding those properties inside the script.

Create an instance of SendEmail class (custom Hertzler class)

email = SendEmail()

 

The recipients must be a list (even if there is only one).

email.recipients = ["recip1@example.com", "recip2@example.com"]

email.sender = login.emailaddress

email.subject = "This is the email subject"

email.body = "This is the email body"

 

Set use_login to True if login is required to send emails and then set the username and password lines for the current user.

email.use_login = True

email.username = login.emailusername

email.password = login.emailpassword

 

This sets the email server address/name and port

email.server = login.emailserver

email.port = login.emailport

 

Send the email.

email.send()