gs.profile.status.send Documentation

This product provides the script that sends the Profile-status notification (What is happening in your groups) to the members of a GroupServer instance.

Contents:

sendprofile

Synopsis

sendprofile [-h] [-c <CONFIG>] [-i <INSTANCE>] [-t <TIME>] [-v] url

Description

sendprofile sends the monthly profile-status notification out to all the people with profiles in a GroupServer instance. Normally it is called by cron(8).

Positional Arguments

url

The URL for the GroupServer site.

Optional Arguments

-h, --help

Show a help message and exit

-c <CONFIG>, --config <CONFIG>

The name of the GroupServer Configuration file (default INSTANCE_HOME/etc/gsconfig.ini) that contains the token that will be used to authenticate the script when it tries to add the email to the site.

-i <INSTANCE>, --instance <INSTANCE>

The identifier of the GroupServer instance configuration to use (default default).

-v, --verbose

Turn on verbose output (default is silent).

-t <TIME>, --throttle <TIME>

The time (in seconds) to pause when the notifications is successfully sent (default 0). For large sites sending the notification can be computationally expensive, and adding a throttle allows other requests to be processed by the server.

Returns

sendprofile returns

  • 0 on success,
  • 130 if the user terminated the program (Control-c), or
  • A value following the convention specified in /usr/include/sysexits.h.

Configuration file

The configuration for the sendprofile script is handled by the gs.config module [1]. It shares its authentication with the smtp2gs script [2].

[1]See gs.config <https://github.com/groupserver/gs.config>
[2]See gs.group.messages.add.smtp2gs <https://github.com/groupserver/gs.group.messages.add.smtp2gs>

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

Changelog

1.0.1 (2015-09-25)

  • Fixing the verbose output, allowing it to be turned off
  • Catching keyboard interrupts (Control-c)

1.0.0 (2015-05-26)

  • Initial version.

Indices and tables