gs.profile.status.send Internals

The gs.profile.status.send does not have a public API, other than what is provided by the script itself. However, the internals are documented below.

The script

The sendprofile script is provided by the module script. The main() function takes the name of the default configuration file a single argument, which is normally supplied by buildout when it generates the sendprofile script from the entry point.

The list of people

gs.profile.status.send.script.PROFILE_URI = u'/gs-profile-status-members.html'

The URL of the web-hook that returns (as a JSON blob) the list of profile IDs

gs.profile.status.send.script.get_userIds(hostname, token)[source]

Get the list of profiles to send the notification to.

Parameters:
  • hostname (str) – The name of the host to use.
  • token (str) – The token to use for authentication.
Raises:

NotOk – When the page does not return an HTTP 200 status code.

Returns:

A list of strings

Return type:

list

Sending the notification

gs.profile.status.send.script.SEND_STATUS_URI = u'/gs-profile-status-send.html'

The URL of the web-hook used to send a digest to a group

gs.profile.status.send.script.send_status(hostname, userId, token)[source]

Send a profile-status notification for a particular person

Parameters:
  • hostname (str) – The name of the host to use.
  • userId (str) – The identifier for the person.
  • token (str) – The token to use for authentication.
Raises:

NotOk – When the page does not return an HTTP 200 status code.

The script proper

gs.profile.status.send.script.main(configFileName=u'etc/gsconfig.ini')[source]

Send the profile status to all the members, using web-hooks

Parameters:configFileName (str) – The name of the configuration file.
gs.profile.status.send.script.show_progress(profileId, curr, total)[source]

Show the progress for sending the profile

Parameters:
  • profileId (str) – The identifier for the profile.
  • curr (int) – The current index of the person.
  • total (int) – The total number of people.

show_progress() displays the verbose feedback. A progress bar is also displayed if the terminal supports it.

gs.profile.status.send.script.show_done(r)[source]

Show feedback when the notification is sent

Parameters:r (dict) – The response from the server