Main class

class NaMi(config={}, **kwargs)[source]

Main class for communication with the DPSG NaMi

Example

Connect to the NaMi, search for all active members and print them in a tabulated form.
from pynami.nami import NaMi
from pynami.tools import tabulate2x

with NaMi(username='MITGLIEDSNUMMER', password='PASSWORD') as nami:
    print(tabulate2x(nami.search()))
Parameters:config (dict, optional) – Authorization configuration
_check_response(response)[source]

Check a requests response object if the NaMi response looks ok. This currently checks some very basic things.

Raises:
_get_baseadmin(key, grpId=None, mglId=None, taetigkeitId=None, **kwargs)[source]

Base function for retrieving all core lists from the NaMi

Parameters:
  • key (str) – Name of the wanted items
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
  • taetigkeitId (int, optional) – Id of an activity. A list of all possible ids can be found in the section Activity types. This is only required for the URLs which needs to be formatted with this value.
Keyword Arguments:
 
  • gruppierung (int or str, optional) – Group id, in case this differs from the group id in the URL (given by grpId)
  • mitglied (int or str, optional) – Member id (not the DPSG Mitgliedsnummer). This overwrites mglId.
Returns:

The returned default values

Return type:

list of Baseadmin

activities

Functional activities

Type:list of Baseadmin
auth(username=None, password=None)[source]

Authenticate against the NaMi API. This stores the jsessionId cookie in the requests session. Therefore this needs to be called only once.

This also stores your id (not the Mitgliednummer) for later pruposes.

Parameters:
  • username (str, optional) – The NaMi username. Which is your Mitgliedsnummer
  • password (str, optional) – Your NAMI password
Returns:

The requests session, including the auth cookie

Return type:

requests.Session

bausteine

Choose DPSG training parts

Type:list of Baseadmin
beitragsarten(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

Each possible fee type

Return type:

list of Baseadmin

beitragsarten_mgl(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

Each possible fee for a member

Return type:

list of Baseadmin

bescheinigungen(**kwargs)[source]

Get all certificates of inspection

Returns:A list of all your certificates of inspection
Return type:list of SearchBescheinigung
countries(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

List of all possible countries with their names and ids

Return type:

list of Baseadmin

download_beantragung(**kwargs)[source]

Open the application form for a certificate of good conduct as a PDF file.

Parameters:**kwargs – See open_download_pdf().
download_bescheinigung(id_, **kwargs)[source]

Open a certificate as a PDF file

Parameters:
download_invoice(id_, **kwargs)[source]

Downloads and opens an invoice as a pdf document.

Parameters:
ebene1

You can choose a Diözese which you belong to.

Type:list of Baseadmin
ebene2(ebene1)[source]

You can choose a Bezirk which you belong to.

Parameters:ebene1 (int) – Group id of a Diözese
Returns:List of possible Bezirken you are associated with
Return type:list of Baseadmin
ebene3(ebene2)[source]

You can choose a Stamm which you belong to.

Parameters:ebene2 (int) – Group id of a Bezirk
Returns:List of possible Stämmen you are associated with
Return type:list of Baseadmin
ebenen

Structural layersin the DPSG

Type:list of Baseadmin
geschlechter(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

You can choose between three genders: male, female and diverse.

Return type:

list of Baseadmin

get_activity(mgl, id_)[source]

Get an activity by its id.

Parameters:
  • mgl (int) – Member id (not DPSG Mitgliedsnummer)
  • id (int) – Id of the activity. This will probably originate from an activity search result, e.g. by calling mgl_activities().
Returns:

The Activity object containing all details.

Return type:

Activity

get_ausbildung(mglId, id_)[source]

Get a training by its id.

Parameters:
  • mglId (int) – Member id (not DPSG Mitgliedsnummer)
  • id (int) – Id of the training. This will probably originate from an training search result, e.g. by calling mgl_ausbildungen().
Returns:

The Ausbildung object containing all details about the training.

Return type:

Ausbildung

get_bescheinigung(id_)[source]

View a certificate of inspection by its id

Parameters:id (int) – The internal id of the certificate
Returns:An object holding all important details about the inspection
Return type:Bescheinigung
get_mgl_history(mglId, id_, ext=True)[source]

Get a member history entry by its id.

Parameters:
  • mglId (int) – Member id (not DPSG Mitgliedsnummer)
  • id (int) – Id of the entry. May originate from a search result, e.g. by calling mgl_history().
  • ext (bool, optional) – If the extended history format should be used. Defaults to True.
Returns:

The object containing all vital information about this history entry.

Return type:

MitgliedHistory

get_tag(mglId, tagId)[source]

Get a tag by its id

Parameters:
  • mglId (int) – Member id (not DPSG Mitgliedsnummer)
  • tagId (int) – Tag id
Returns:

The tag object with all important details

Return type:

Tag

grpId

Group id of the user

Returns:int
grpadmin_grps

Choose from a list of groups that you are associated with for group admin

Type:list of Baseadmin
gruppierungen

Choose from a list of groups that you are associated with for member admin

Type:list of Baseadmin
history(**kwargs)[source]

Dashboard function

Returns:Last editing events like updating and creating members.In the NaMi these are displayed in the dashboard.
Return type:list of HistoryEntry
invoice(groupId, invId)[source]

Get an invoice by its id.

Parameters:
  • groupId (int) – Group id
  • invId (int) – Id of the invoice. This will probably originate from a search result, e.g. by calling invoices().
Returns:

The Invoice object containing all details.

Return type:

Invoice

invoices(groupId=None, **kwargs)[source]

List of all invoices of a group

Parameters:groupId (int, optional) – Group id
Returns:All invoices of the specified group
Return type:list of SearchInvoice
konfessionen(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

All denominations

Return type:

list of Baseadmin

logout()[source]

This should be called at the end of the communication. It is called when exiting through the __exit__() method.

mgl_activities(mgl)[source]

List of all activities of a member

Parameters:mgl (int) – Member id (not DPSG Mitgliedsnummer)
Returns:All activities of the member (even those which have already ended)
Return type:list of Activity
mgl_ausbildungen(mglId)[source]

Get all trainings from a Mitglied.

Parameters:mglId (int) – Member id (not DPSG Mitgliedsnummer)
Returns:All trainings of the member
Return type:list of SearchAusbildung
mgl_history(mglId, ext=True)[source]

Get all history changes from a Mitglied.

Parameters:
  • mglId (int) – Member id (not DPSG Mitgliedsnummer)
  • ext (bool, optional) – If the extended history format should be used. Defaults to True.
Returns:

All history entries of the member

Return type:

list of HistoryEntry

mgltypes(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

You can have one of three different member types

Return type:

list of Baseadmin

mitglied(mglId=None, method='GET', grpId=None, **kwargs)[source]

Gets or updates a Mitglied.

The keyword arguments are passed on to the HTTP communication

Parameters:
  • mglId (int, optional) – ID of the Mitglied. This is not the DPSG Mitgliedsnummer. Defaults to the user.
  • method (str) – HTTP Method. Should be 'GET' or 'PUT', defaults to 'GET'.
  • grpId (int, optional) – The DPSG Stammesnummer, e.g. 131913. The default (None) takes the value from the internal attribute __config.
Returns:

The retrieved or respectively updated Mitglied. Note that the austrittsDatum attribute is not part of the returned data set.

Return type:

Mitglied

myId

NaMi internal id of the user

Returns:int
notifications(sortproperty=None, sortdirection='ASC', **kwargs)[source]

Dashboard function

Returns:All current notifications (like tier changes of members). In the NaMi these are displayed in the dashboard.
Return type:list of Notification
regionen(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

All possible Bundeslaender

Return type:

list of Baseadmin

search(**kwargs)[source]

Run a search for members

Todo

  • Check search terms and formatting. Also some search keys can only be used mutually exclusive.
Parameters:**kwargs – Search keys and words. Be advised that some search words must have a certain formatting or can only take a limited amount of values.
Returns:The search results
Return type:list of SearchMitglied

See also

SearchSchema for a complete list of search keys

search_all(grpId=None, filterString=None, searchString='', sortproperty=None, sortdirection='ASC', **kwargs)[source]

Search function for filtering the whole member list with limited filter options.

It is also possible to sort the results.

Parameters:
  • filterString (str, optional) – Filter attribute.
  • searchString (str, optional) – You can search within the chosen filter attribute. The Format must match the type of the filter attribute.
  • sortproperty (str, optional) – Attribute by wich the results shall be sorted.
  • sortdirection (str, optional) – Direction of sorting. Can take the values ASC (wich is the default) and DESC.
Returns:

The search results

Return type:

list of SearchMitglied

staaten(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

A quite long list of different nationalities

Return type:

list of Baseadmin

stats

Contains counts from different tiers. The actual list of StatCategory is in the statsCategories attribute.

Type:Stats
status_list

If you are active, inactiv or already deleted

Type:list of Baseadmin
subdivision

Which division you are associated with. This one is only used for searching.

Type:list of Baseadmin
tagList

A different list of fee types but with basically the same content. This one is used for searching members.

Deprecated since version 0.3.3: Only returns an empty list and has therefore become useless.

Type:list of Baseadmin
tags(mglId, **kwargs)[source]

Get all tags of a member

Parameters:mglId (int) – Member id (not DPSG Mitgliedsnummer)
Returns:List of the search results
Return type:list of SearchTag
tk_auf_grp(grpId, mglId, **kwargs)[source]

Get all possible activities for a certain group

Parameters:
  • grpId (int or str) – Group id
  • mglId (int or str) – Member id (not the DPSG Mitgliedsnummer)
Returns:

List of possible activities

Return type:

list of Baseadmin

tk_caea_grp(grpId, mglId, taetigkeitId, **kwargs)[source]

Get all possible access rights for an activity

Parameters:
  • grpId (int or str) – Group id
  • mglId (int or str) – Member id (not the DPSG Mitgliedsnummer)
  • taetigkeitId (int) – Id of the activity. A list of all possible ids can be found in the section Activity types.
Returns:

List of possible access rights

Return type:

list of Baseadmin

tk_grp(grpId, mglId, **kwargs)[source]

Get all possible groups for an activity

Parameters:
  • grpId (int or str) – Group id
  • mglId (int or str) – Member id (not the DPSG Mitgliedsnummer)
Returns:

List of possible groups

Return type:

list of Baseadmin

tk_ug(grpId, mglId, taetigkeitId, **kwargs)[source]

Get all possible subdivision for an activity

Parameters:
  • grpId (int or str) – Group id
  • mglId (int or str) – Member id (not the DPSG Mitgliedsnummer)
  • taetigkeitId (int) – Id of the activity. A list of all possible ids can be found in the section Activity types.
Returns:

List of possible subdivision

Return type:

list of Baseadmin

update_activity(mgl, act)[source]

Update an activity

Parameters:
  • mgl (int) – Member id (not DPSG Mitgliedsnummer)
  • act (Activity) – Updated data set. The activity id is taken form this data set.
Returns:

A new updated object

Return type:

Activity

Warning

This has not been tested yet!

update_ausbildung(mglId, ausbildung)[source]

Update a training

Parameters:
  • mgl (int) – Member id (not DPSG Mitgliedsnummer)
  • ausbildung (Ausbildung) – Updated data set. The training id is taken form this data set.
Returns:

A new updated object

Return type:

Ausbildung

Warning

This has not been tested yet!

zahlungskonditionen(grpId=None, mglId=None)[source]

Get default values

Parameters:
  • grpId (int or str, optional) – Group id
  • mglId (int or str, optional) – Member id (not the DPSG Mitgliedsnummer)
Returns:

Every paying method (either bank transfer or debit)

Return type:

list of Baseadmin