Python package for the DPSG NaMi API¶
Installation¶
For this package to run you need at least Python 3.6. All other dependencies are installed automatically.
Just download and extract the repository or simply clone it, navigate to its top directory (where setup.py
is located) and run
pip install [-e] .
Use the -e
option if you want to edit the source files afterwards.
Usage¶
The package should be quite comfortable to use without loosing flexibility.
Authentification¶
from pynami.nami import NaMi
with NaMi(username='MITGLIEDSNUMMER', password='PASSWORD') as nami:
pass
from pynami.nami import NaMi
nami = NaMi()
nami.auth(username='MITGLIEDSNUMMER', password='PASSWORD')
# do stuff
nami.logout()
Access default values¶
from pynami.tools import tabulate2x
print(tabulate2x(nami.geschlechter()))
Get a specific mitglied¶
id_ = nami.search(vorname='Max', nachname='Mustermann')[0].id
mgl = nami.mitglied(id_)
print(mgl.mitgliedsNummer)
Search for a group of members¶
search = {
'mglStatusId': 'AKTIV',
'mglTypeId': 'MITGLIED',
'untergliederungId': [2, 3],
'taetigkeitId': 1
}
result = nami.search(**search)
print(tabulate2x(result))
Send emails¶
from pynami.tools import send_emails
send_emails(result)
Export data¶
There are two functions for exporting data. The first is to export the data as a CSV formatted string and save that as a file using the method make_csv()
.
from pynami.tools import make_csv
keys = ['mitgliedsNummer', 'vorname', 'nachname', 'geschlecht', 'geburtsDatum']
with open('data.csv', 'w', newline='', encoding='utf-8-sig') as f:
f.writelines(make_csv(result, keys, delimiter=';'))
Another option is to export the data as an Excel file using the function export_xlsx()
which comes already with a possible write to file functionality.
from pynami.tools import export_xlsx
export_xlsx(result, keys, write_to_file=True, filepath='data.xlsx')
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: NamiHTTPError
– When HTTP communication failesNamiResponseSuccessError
– When the NaMi returns an error
-
_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
orstr
, optional) – Group id - mglId (
int
orstr
, 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: Returns: The returned default values
Return type: - key (
-
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: Returns: The requests session, including the auth cookie
Return type:
-
beitragsarten
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: Each possible fee type
Return type:
-
beitragsarten_mgl
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: Each possible fee for a member
Return type:
-
bescheinigungen
(**kwargs)[source]¶ Get all certificates of inspection
Returns: A list of all your certificates of inspection Return type: list
ofSearchBescheinigung
-
countries
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: List of all possible countries with their names and ids
Return type:
-
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: - id (int) – Internal id of the certificate
- **kwargs – See
open_download_pdf()
.
-
download_invoice
(id_, **kwargs)[source]¶ Downloads and opens an invoice as a pdf document.
Parameters: - id (int) – Id of the invoice (not the regular invoice number)
- **kwargs – See
open_download_pdf()
.
-
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
ofBaseadmin
-
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
ofBaseadmin
-
geschlechter
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: You can choose between three genders: male, female and diverse.
Return type:
-
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:
-
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:
-
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 toTrue
.
Returns: The object containing all vital information about this history entry.
Return type:
-
get_tag
(mglId, tagId)[source]¶ Get a tag by its id
Parameters: Returns: The tag object with all important details
Return type:
-
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
ofBaseadmin
-
gruppierungen
¶ Choose from a list of groups that you are associated with for member admin
Type: list
ofBaseadmin
-
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
ofHistoryEntry
-
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:
-
invoices
(groupId=None, **kwargs)[source]¶ List of all invoices of a group
Parameters: groupId ( int
, optional) – Group idReturns: All invoices of the specified group Return type: list
ofSearchInvoice
-
konfessionen
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: All denominations
Return type:
-
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
ofActivity
-
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
ofSearchAusbildung
-
mgl_history
(mglId, ext=True)[source]¶ Get all history changes from a Mitglied.
Parameters: Returns: All history entries of the member
Return type: list
ofHistoryEntry
-
mgltypes
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: You can have one of three different member types
Return type:
-
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: - mglId (
-
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
ofNotification
-
regionen
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: All possible Bundeslaender
Return type:
-
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
ofSearchMitglied
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 valuesASC
(wich is the default) andDESC
.
Returns: The search results
Return type: - filterString (
-
staaten
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: A quite long list of different nationalities
Return type:
-
stats
¶ Contains counts from different tiers. The actual list of
StatCategory
is in thestatsCategories
attribute.Type: Stats
-
subdivision
¶ Which division you are associated with. This one is only used for searching.
Type: list
ofBaseadmin
-
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
ofBaseadmin
Get all tags of a member
Parameters: mglId (int) – Member id (not DPSG Mitgliedsnummer) Returns: List of the search results Return type: list
ofSearchTag
-
tk_auf_grp
(grpId, mglId, **kwargs)[source]¶ Get all possible activities for a certain group
Parameters: Returns: List of possible activities
Return type:
-
tk_caea_grp
(grpId, mglId, taetigkeitId, **kwargs)[source]¶ Get all possible access rights for an activity
Parameters: Returns: List of possible access rights
Return type:
-
tk_grp
(grpId, mglId, **kwargs)[source]¶ Get all possible groups for an activity
Parameters: Returns: List of possible groups
Return type:
-
tk_ug
(grpId, mglId, taetigkeitId, **kwargs)[source]¶ Get all possible subdivision for an activity
Parameters: Returns: List of possible subdivision
Return type:
-
update_activity
(mgl, act)[source]¶ Update an activity
Parameters: Returns: A new updated object
Return type: 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: Warning
This has not been tested yet!
-
Constants¶
Here is an overwiev about the default values and their ids the NaMi uses.
Warning
These values may change over time (e.g. when a new AG for a annual campaign comes up) Current state: 12.05.2023
Bundesländer¶
Beschreibung | ID |
---|---|
Baden-Württemberg (Deutschland) | 1 |
Bayern (Deutschland) | 2 |
Berlin (Deutschland) | 3 |
Brandenburg (Deutschland) | 4 |
Bremen (Deutschland) | 5 |
Hamburg (Deutschland) | 6 |
Hessen (Deutschland) | 7 |
Mecklenburg-Vorpommern (Deutschland) | 8 |
Niedersachsen (Deutschland) | 9 |
Nordrhein-Westfalen (Deutschland) | 10 |
Rheinland-Pfalz (Deutschland) | 11 |
Saarland (Deutschland) | 12 |
Sachsen (Deutschland) | 13 |
Sachsen Anhalt (Deutschland) | 14 |
Schleswig-Holstein (Deutschland) | 15 |
Thüringen (Deutschland) | 16 |
Nicht-DE (Ausland) | 23 |
See also
Countries¶
Beschreibung | ID |
---|---|
Deutschland | 1 |
Algerien | 2 |
Belgien | 3 |
Brasilien | 4 |
Dänemark | 5 |
Finnland | 6 |
Frankreich | 7 |
Grossbritanien | 8 |
Irland | 9 |
Island | 10 |
Israel | 11 |
Italien | 12 |
Japan | 13 |
Kanada | 14 |
Litauen | 15 |
Luxemburg | 16 |
Niederlande | 17 |
Norwegen | 18 |
Österreich | 19 |
Polen | 20 |
Rumänien | 21 |
Schweiz | 22 |
Schweden | 23 |
Slowenien | 24 |
Spanien | 25 |
Südafrika | 26 |
Thailand | 27 |
Ungarn | 28 |
Vatikanstadt | 29 |
USA | 30 |
Indien | 31 |
Polen | 32 |
CV | 33 |
Ausland | 34 |
Malaysia | 35 |
Tunesien | 36 |
See also
Nationalities¶
Beschreibung | ID |
---|---|
Bosnisch | 1284 |
USA/SLO | 1286 |
serb.montenegro | 1287 |
serbisch | 1288 |
französich | 1289 |
A | 1291 |
holländisch | 1292 |
Kenia | 1293 |
madegaschi | 1294 |
|
1295 |
St. Lucianer | 1296 |
lettisch | 1297 |
Iran | 1298 |
japanisch | 1299 |
österr. + südafr. | 1304 |
italiano | 1306 |
Ukrainerin | 1308 |
deutsch | 1054 |
Serbien-Montenegro | 1310 |
Jugoslawisch/Kosovo | 1311 |
1056 | |
ungarisch | 1312 |
andere | 1057 |
chinesisch | 1058 |
österreichisch | 1059 |
Thailand | 1315 |
italienisch | 1060 |
EU | 1061 |
maltesisch | 1317 |
Portugiesisch | 1318 |
niederländisch | 1064 |
schweizerisch | 1320 |
kenianisch | 1065 |
Tschechische Republick | 1321 |
kroatisch | 1066 |
brasilianisch | 1067 |
weißrussisch | 1323 |
polnisch | 1069 |
Bolivien | 1326 |
türkisch | 1071 |
österr. | 1327 |
Grieche | 1329 |
portugiesisch | 1074 |
Burundi | 1331 |
amerikanisch | 1076 |
Brittisch | 1333 |
österreich | 1081 |
Albanien | 1338 |
Nigeria | 1339 |
GB | 1340 |
mazedonisch | 1341 |
britisch | 1086 |
Togolaise | 1343 |
Schweizer | 1088 |
pakistanisch | 1344 |
Thai | 1089 |
österreichschich/norwegisch | 1345 |
litauisch | 1091 |
Portugal | 1347 |
griechisch | 1092 |
Italienisch-Österr. | 1348 |
schweizerisch | 1093 |
guatemaltekisch | 1349 |
belgisch | 1094 |
nicht bekannt | 1350 |
Portugiesich | 1352 |
lettisch | 1102 |
französisch | 1103 |
spanisch | 1104 |
british | 1360 |
marokkanisch | 1361 |
Togo | 1106 |
albanisch | 1107 |
Niederländer | 1364 |
Sri Lanka | 1110 |
estnisch | 1366 |
Indien | 1111 |
Eritrea | 1112 |
slowakisch | 1370 |
Serbe | 1115 |
Algerisch | 1372 |
indonesisch | 1117 |
griech. | 1373 |
yugoslawisch | 1118 |
englisch/plonisch | 1119 |
irisch | 1375 |
bosnisch-herzegow. | 1120 |
Jugoslawisch | 1376 |
Italienisch | 1121 |
Irisch | 1122 |
libanesisch | 1123 |
iranisch | 1124 |
Bulgarien/Belgien | 1380 |
polnisch/italiensch | 1381 |
amerikanisch | 1126 |
salvadorianisch | 1127 |
Russische Föderation | 1384 |
US | 1129 |
Rumänisch | 1385 |
Ungarn | 1130 |
U.S. Amerikaner | 1386 |
SERBIEN | 1387 |
Spanisch | 1132 |
ukrainisch | 1133 |
Belgier | 1389 |
eritreisch | 1134 |
philippinisch | 1135 |
Ghana | 1391 |
jugoslawisch | 1137 |
Amerikaner | 1393 |
tschechisch | 1138 |
kongolesisch | 1394 |
portugisiesch | 1395 |
Bosnien und Herzegowina | 1140 |
Portugisiesch | 1396 |
Türkisch | 1141 |
nigerianisch | 1397 |
bosnisch | 1142 |
Indonesisch | 1398 |
British | 1143 |
griechisch-amerikanisch | 1399 |
portugisisch | 1144 |
CH | 1146 |
Malaysian | 1405 |
Filipina | 1150 |
vietnam | 1151 |
Kroatien | 1152 |
venezuelanisch | 1408 |
Brasilien | 1410 |
niederländer | 1155 |
U.S.Amerikaner | 1411 |
vietnamesisch | 1156 |
ECU | 1412 |
Luxemburgisch | 1413 |
Britisch | 1158 |
Österreich | 1159 |
amerikanisch / polnisch | 1415 |
kanadisch | 1160 |
schweiz | 1416 |
Thailänder | 1417 |
Irakisch | 1162 |
Peru | 1418 |
Italien | 1163 |
Kirgystan | 1164 |
australisch | 1420 |
GB (EU) / USA | 1421 |
Tschad | 1166 |
bolivisch | 1422 |
Bosnien | 1167 |
ital./portug. | 1168 |
frz | 1426 |
Portugisisch | 1427 |
croatisch | 1173 |
Haiti | 1429 |
Kroatisch | 1174 |
Belgisch | 1175 |
russisch | 1176 |
Mexikaner | 1432 |
Kongolese | 1433 |
irakisch | 1179 |
mexikanisch | 1435 |
Französisch | 1180 |
brasilianische | 1436 |
Kanadisch / Niederländisch | 1437 |
rumänisch | 1182 |
moldawisch | 1183 |
US-Amerikaner | 1439 |
Albanisch | 1184 |
niederländiscch | 1440 |
Neiderländisch / Englisch | 1185 |
Ägypten | 1441 |
jugosl. | 1186 |
und spanisch | 1442 |
bolivianisch | 1187 |
Amerikanerin | 1443 |
+italienisch | 1444 |
Brasilien / Österreich | 1446 |
chilenisch | 1191 |
Polen | 1447 |
Serbisch | 1192 |
kazachstan | 1193 |
US-amerikanisch | 1194 |
Kongo | 1450 |
thailändisch | 1451 |
Amerikanisch | 1196 |
und australisch | 1452 |
togoisch | 1453 |
Slowenien | 1199 |
Kurdisch | 1455 |
Russisch | 1200 |
Philippiner | 1456 |
tschetschenisch | 1457 |
Mosambik | 1458 |
Schweiz | 1203 |
Guatemala | 1459 |
Brasilianisch | 1460 |
Kroate | 1205 |
Äthopien | 1461 |
usbekisch | 1462 |
Indisch | 1463 |
USA / GB(EU) | 1465 |
vietnamesich | 1210 |
Britsch | 1466 |
syrisch | 1211 |
Japanisch | 1467 |
Tai | 1468 |
Türkei | 1213 |
F | 1214 |
Ukraine | 1215 |
Weißrussland | 1471 |
slowenisch | 1216 |
Äthiopisch | 1472 |
luxemburgisch | 1218 |
Rumänien | 1219 |
|
1475 |
Serbien | 1220 |
Kenianer | 1476 |
Griechisch | 1221 |
kroatische | 1477 |
kosovarisch | 1222 |
Litauisch | 1479 |
kasachisch | 1225 |
Südkorea | 1481 |
tunesisch | 1482 |
kamerunesisch | 1229 |
philipino | 1233 |
phillipino | 1234 |
port. | 1235 |
luxemb. | 1236 |
N-amerikanisch | 1237 |
F - CH | 1238 |
NL | 1239 |
theiländisch | 1243 |
Vietnam | 1246 |
Bulgarien | 1247 |
bulgarisch | 1250 |
norwegisch | 1251 |
rwander | 1252 |
ägypt. | 1254 |
B | 1255 |
dänisch | 1259 |
türk. | 1261 |
Syrisch | 1262 |
domenikanisch | 1263 |
tamilisch | 1265 |
äthiopisch | 1266 |
pl | 1268 |
griechisch | 1269 |
Togolesisch | 1271 |
kamerunisch | 1272 |
Polnisch | 1273 |
persisch | 1276 |
Irak | 1277 |
Ukrainisch | 1278 |
Tschechisch | 1279 |
See also
Payment details¶
Member management¶
Beschreibung | ID |
---|---|
Std Lastschrift | 1 |
Std Überweisung | 2 |
See also
Beschreibung | ID |
---|---|
DPSG Bundesverband 000000 (Familienermäßigt - Stiftungseuro - VERBANDSBEITRAG) | 5 |
DPSG Bundesverband 000000 (Familienermäßigt - VERBANDSBEITRAG) | 2 |
DPSG Bundesverband 000000 (Sozialermäßigt - Stiftungseuro - VERBANDSBEITRAG) | 6 |
DPSG Bundesverband 000000 (Sozialermäßigt - VERBANDSBEITRAG) | 3 |
DPSG Bundesverband 000000 (Übernahme - VERBANDSBEITRAG) | 7 |
DPSG Bundesverband 000000 (Voller Beitrag - Stiftungseuro - VERBANDSBEITRAG) | 4 |
DPSG Bundesverband 000000 (Voller Beitrag - VERBANDSBEITRAG) | 1 |
See also
The following table can be obtained with a different function and is given here for the sake of completeness.
Beschreibung | ID |
---|---|
Familienermäßigt | 2 |
Übernahme | 7 |
Voller Beitrag | 1 |
Voller Beitrag - Stiftungseuro | 4 |
Familienermäßigt - Stiftungseuro | 5 |
Sozialermäßigt | 3 |
Sozialermäßigt - Stiftungseuro | 6 |
See also
See also
- Default values
- How to get these values
Ids for searching¶
Deprecated since version 0.3.3: No longer in use. You will just get an empty list.
-
GET
//tagging/getTagList
¶ Get default values and their ids.
Query Parameters: - page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned entries
- data (list) –
The search results. Each returned tag is a list entry in the form of a json array.
See also
BaseadminSchema
- JSON schema of the returned data
Status Codes: - 200 OK – No error
See also
Confessions¶
Beschreibung | ID |
---|---|
römisch-katholisch | 1 |
evangelisch / protestantisch | 2 |
orthodox | 3 |
freikirchlich | 4 |
andere christliche | 5 |
jüdisch | 6 |
muslimisch | 7 |
sonstige | 8 |
ohne Konfession | 9 |
neuapostolisch | 11 |
See also
Member types and states¶
Member types¶
-
GET
/nami/enum/mgltype
¶ Get default values and their ids.
Query Parameters: - gruppierung (int) – A chosen group id (usually your Stammesnummer) (optional)
- mitglied (int) – Member id (not the DPSG Mitgliedsnummer) (optional)
- page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned entries
- data (list) –
The search results. Each returned member type is a list entry in the form of a json array.
Latest search results¶ Beschreibung ID Nicht-Mitglied NICHT_MITGLIED Schnuppermitglied SCHNUPPER_MITGLIED Mitglied MITGLIED See also
See also
BaseadminSchema
- JSON schema of the returned data
Status Codes: - 200 OK – No error
Member states¶
-
GET
/nami/search-multi/status-list
¶ Get default values and their ids.
Query Parameters: - page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned entries
- data (list) –
The search results. Each returned member state is a list entry in the form of a json array.
Latest search results¶ Beschreibung ID Aktiv AKTIV Inaktiv INAKTIV archiviert GELOESCHT_ALT See also
See also
BaseadminSchema
- JSON schema of the returned data
Status Codes: - 200 OK – No error
DPSG Bausteine¶
-
GET
/module/baustein
¶ Get default values and their ids.
Query Parameters: - gruppierung (int) – A chosen group id (usually your Stammesnummer) (optional)
- mitglied (int) – Member id (not the DPSG Mitgliedsnummer) (optional)
- page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned entries
- data (list) –
The search results. Each returned baustein is a list entry in the form of a json array.
Baustein tags (latest search results)¶ Beschreibung ID Schritt 1 - Motivation und Grundlagen zum Leiten, Ausbildung in der DPSG 21 Schritt 2 - Gestaltung und Organisation von Gruppenstunden 22 Baustein 1a - Identität und Leitungsstil 3 Baustein 1b - Teamarbeit 4 Baustein 1c - Gesellschaftliches Engagement 5 Baustein 1d (Bis 2016 3d) - Spiritualität 14 Baustein 2a - Lebenswelt von Kindern und Jugendlichen, Pädagogik der DPSG 6 Baustein 2b - Mädchen und Jungen, Geschlechtsbewusste Gruppenarbeit 7 Baustein 2c - Pfadfinderische Grundlagen: Pfadfinderische Methodik 8 Baustein 2d - Gewalt gegen Kinder und Jugendliche: Sensibilisierung, Intervention 9 Baustein 2e - Gewalt gegen Kinder und Jugendliche: Vertiefung, Prävention 10 Baustein 3a - Pfadfinderische Grundlagen: Geschichte und Hintergründe 11 Baustein 3b - Erste Hilfe 12 Baustein 3c - Finanzen, Haftung und Versicherung 13 Baustein 3e - Pfadfindertechniken 1 Baustein 3f - Planung und Durchführung von Maßnahmen 2 Abgeschlossene Modulausbildung - oder Woodbadge-Kurs I 25 Woodbadge-Kurs oder Woodbadge-Kurs II - Wölflinge 17 Woodbadge-Kurs oder Woodbadge-Kurs II - Jungpfadfinder 18 Woodbadge-Kurs oder Woodbadge-Kurs II - Pfadfinder 19 Woodbadge-Kurs oder Woodbadge-Kurs II - Rover 20 Woodbadge-Kurs oder Woodbadge-Kurs II - Vorstände 23 Modulleitungstraining (MLT) - Modulleitungstraining (MLT) 26 Teamer Training I (TT I) - Wölflinge 27 Teamer Training I (TT I) - Jungpfadfinder 29 Teamer Training I (TT I) - Pfadfinder 30 Teamer Training I (TT I) - Rover 31 Teamer Training I (TT I) - Vorstände 32 Teamer Training II (TT II) - Wölflinge 33 Teamer Training II (TT II) - Jungpfadfinder 28 Teamer Training II (TT II) - Pfadfinder 34 Teamer Training II (TT II) - Rover 35 Teamer Training II (TT II) - Vorstände 36 Assistant Leadertrainer Training (ALT) - Assistant Leadertrainer Training (ALT) 24 Kuratenausbildung - Ausbildung der Kuratinnen und Kuraten 37 Sonstiges - Kurse ausserhalb der Woodbadge-Ausbildung (Kein Baustein!) 38 See also
See also
BaseadminSchema
- JSON schema of the returned data
- metaData (json) – Additional information about the data fields but not on the data itself.
Status Codes: - 200 OK – No error
Subdivision¶
-
GET
/orgadmin/untergliederung
¶ Get default values and their ids.
Query Parameters: - gruppierung (int) – A chosen group id (usually your Stammesnummer)
- mitglied (int) – Member id (not the DPSG Mitgliedsnummer)
- page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned entries
- data (list) –
The search results. Each returned subdivision is a list entry in the form of a json array.
Subdivision types for searching (latest search results)¶ Beschreibung ID AG Ausbildung 24 AG Ausbildung Pfadfinderstufe 75 AG Digitale Infrastruktur und Tools 74 AG DPSG App 50 AG Freiwilligendienst 51 AG Friedenslicht 52 AG Geschlechtergerechtigkeit 53 AG Jahresaktion 2018 - Lebendig. Kraftvoll. Schärfer. Glaubste? 55 AG Jahresaktion 2019 - vollKostbar 54 AG Jahresaktion 2020 - No waste - ohne Wenn und Abfall 69 AG Jahresaktion 2021 - Pfadfinderinnen/Pfadfinder sind MITTENdrin 70 AG Jahresaktion 2022 - Pfadfinden ist bunt 73 AG Jahresaktion 2023 - Unter Strom 77 AG Jahresaktion 2024 - Antirassismus 81 AG Kompass 79 AG NaMi Community Management NCM 57 AG Netzwerk DPSG 56 AG Öffentlichkeitsarbeit 22 AG Ordnung 62 AG Pfingsten in Westernohe PIW 58 AG Politische Bildung 59 AG Satzungsfragen 31 AG Spiritualität 42 AG Stärkung Strukturschwacher Regionen 76 AG Transparente Finanzen 60 AG WBK-Rahmenkonzept 61 Archivbeirat 64 Aufarbeitung - Beirat 80 BDKJ 17 Biber 49 Bundesamt 38 Bundesebene 39 Campstaff PIW 72 Elternbeirat 14 Entwicklungsfragen 6 Freunde und Förderer 35 Hauptausschuss 29 Inklusion 8 Interkulturelles Lernen 7 Internationale Gerechtigkeit 41 Internationales 21 Jugendhilfeausschuss 20 Jugendring 18 Junge Delegierte rdp 78 Jungpfadfinder 2 Kuratorium Westernohe 65 Landesstelle 37 MoViS - Beauftragte/Beauftragter für ehrenamtliches Engagement 71 Ökologie 26 Pfadfinder 3 PGR 19 RdP 16 Rechnungsprüfungsausschuss RPA 66 Rechtsträger 15 Rover 4 SG internationale Ausbildung 68 SG Nahost 67 Sonstige 48 Sonstige Mitarbeitende (mit Versicherungsschutz) 13 Sonstige Mitarbeitende (ohne Versicherungsschutz) 47 StG Deutsch-Französisch 40 Stiftung 36 Vorstand 5 Wahlausschuss 30 Westernohe 34 Wölfling 1 See also
BaseadminSchema
- JSON schema of the returned data
See also
- metaData (json) – Additional information about the data fields but not on the activities themselves.
Status Codes: - 200 OK – No error
Activity types¶
-
GET
/nami/search-multi/all-visible-taetigkeiten
¶ Get default values and their ids.
Query Parameters: - gruppierung (int) – A chosen group id (usually your Stammesnummer)
- mitglied (int) – Member id (not the DPSG Mitgliedsnummer)
- page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned entries
- data (list) –
The search results. Each returned activity is a list entry in the form of a json array.
All activity types for searching¶ Beschreibung ID Mitgliederservice 42 Erstelllen von SGBVIII Bescheinigungen 43 Datenschutzerklärung EAs abgegeben 45 Präventionsschulung EAs 46 soz. erm. Beiträge zuweisen 47 € Helfer AK/AG/StG/SG 48 € Mitglied 1 x € AdministratorIn 14 € Mitglied AK/AG/StG/SG 18 € passive Mitgliedschaft 39 Beitragsabrechnung 36 € BeobachterIn 8 € Delegierte(r) 7 - ElternvertreterIn
4 EmpfängerIn Freiexemplar 37 Empfänger Freiexemplare 28 € Ersatzdelegierte(r) 31 € GeschäftsführerIn 19 - hauptberufliche Mitarbeiter
22 € KassenprüferIn 21 € KassiererIn 20 KontakterIn 32 € KuratIn 11 € LeiterIn 6 € Leitungsteam-SprecherIn 5 € MaterialwartIn 23 sonst. MitarbeiterIn 16 Ref. Ersatzdelegierte(r) 30 Ref.-Delegierte(r) 25 € ReferentIn 10 € SprecherIn 2 stellv. Vorsitzende(r) 26 stellvertr. Mitglied 34 Stufendelegierte(r) 33 Versandanschrift 29 - VertreterIn (BDKJ/RDP etc.)
24 € Vorsitzende(r) 13 € sonst. Mitglied 40 - sonst. ext. MitarbeiterIn
41 Stammessuche 44 Schnuppermitgliedschaft 35 See also
See also
BaseadminSchema
- JSON schema of the returned data
- metaData (json) – Additional information about the data fields but not on the activities themselves.
Status Codes: - 200 OK – No error
REST URLs¶
The default server URL for the NaMi is
Authentification¶
-
POST
/nami/auth/manual/sessionStartup
¶ Login
Query Parameters: - username (string) – The DPSG member id
- password (string) – Your password
-
GET
/nami/auth/logout
¶ Logout. Ends the current session.
Search members¶
List all group members though filtering by one value is possible
Parameters: - groupId (int) – A chosen group id (usually your Stammesnummer)
Query Parameters: - filterString (string) – The filter attribute (optional)
- searchString (string) – Search value. If the filter attribute refers to a date the format is
YYYY-mm-dd HH:MM:SS
. - page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned members
- data (list) –
The search results. Each returned member is a list entry in the form of a json array.
See also
SearchMitgliedSchema
- JSON schema of the returned members
Status Codes: - 200 OK – No error
-
GET
/nami/search-multi/result-list
¶ Search members by multiple keys
Query Parameters: - searchedValues (string) – A json formatted string of all search values
- page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned members
- data (list) –
The search results. Each returned member is a list entry in the form of a json array.
See also
SearchMitgliedSchema
- JSON schema of the returned members
Status Codes: - 200 OK – No error
Get a member by its id (not the DPSG Mitgliedsnummer)
Parameters: - groupId (int) – A chosen group id (usually your Stammesnummer)
- mglId (int) – Member id (not the DPSG Mitgliedsnummer)
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- message (string) – Should be
null
. - title (string) – Should be
null
. - data (json) –
Contains all relevant information about the member
See also
MitgliedSchema
- JSON schema of the returned member
Status Codes: - 200 OK – No error
Update members¶
Update information about a member.
Parameters: - groupId (int) – A chosen group id (usually your Stammesnummer)
- mglId (int) – Member id (not the DPSG Mitgliedsnummer)
JSON Parameters: - beitragsArt (string) – Fee type
- beitragsArtId (id) – Id of the fee type
- eintrittsdatum – Begin of association (Format:
YYYY-mm-dd HH:MM:SS
) - email (string) – Primary email address
- emailVertretungsberechtigter (string) – Email address of an authorized representative.
- ersteTaetigkeit (string) – First activity. Defaults to
null
. - ersteUntergliederung (string) – First tier.
- fixBeitrag (string) – Defaults to
null
. - geburtsDatum (string) – Birth date (Format:
YYYY-mm-dd HH:MM:SS
) - genericField1 (string) – Not sure why these even exist.
- genericField1 – Not sure why these even exist.
- geschlecht (string) – Gender
- geschlechtId (int) – Corresponding id to the gender
- gruppierung (string) – Group name including its id
- gruppierungId (string) – Group id as a string
- id (int) – Member id
- jungpfadfinder (string) –
- konfession (string) – Confession
- confessionId (int) – Id corresopnding to the confession
- kontoverbindung (string) – JSON formatted string of the payment details
- land (string) – Country the member lives in
- landId (int) – Id corresponding to the address country
- mglType (string) – Member type
- nachname (string) – Surname
- nameZusatz (string) – Additional name
- ort (string) – Address city
- pfadfinder (string) –
- plz (string) – Postal code
- region (string) – Name of the address state
- regionId (int) – Id of the address state
- rover (string) –
- sonst01 (boolean) – Defaults to
false
. - sonst02 (boolean) – Defaults to
false
. - spitzname (string) – Nickname
- staatsangehoerigkeit (string) – Citizenship
- staatsangehoerigkeitId (string) – Id of the citizenship
- status (string) – If the member is active or inactive
- strasse (string) – Address street
- stufe (string) – Current tier of the member
- telefax (string) – Fax number
- telefon1 (string) – First telephone number
- telefon2 (string) – Second telephone number
- telefon3 (string) – Third telephone number
- version (int) – History version number
- vorname (string) – First name
- wiederverwendenFlag (boolean) – If the member data may be used after the membership ends
- woelfing (string) –
- zeitschriftenversand (boolean) – If the member gets the DPSG newspaper.
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- message (string) – Should be
Update successful
. - title (string) – Should be
null
. - data (json) –
Contains all information about the updated member
See also
MitgliedSchema
- JSON schema of the returned member
Status Codes: - 200 OK – No error
Activities¶
Retrieve all activities of a member. There is also an option for filtering the results.
Parameters: - mglId (int) – Member id (not the DPSG Mitgliedsnummer)
Query Parameters: - page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
- filterString (string) – The filter attribute (optional)
- searchString (string) – Search value. If the filter attribute refers to a date the format is
YYYY-mm-dd HH:MM:SS
.
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned members
- data (list) –
The search results. Each returned activity is a list entry in the form of a json array.
See also
SearchActivitySchema
- JSON schema of the returned activity
- metaData (json) – Additional information about the data fields but not on the activities themselves.
Status Codes: - 200 OK – No error
Get a single activity by its id.
Parameters: - mglId (int) – Member id (not the DPSG Mitgliedsnummer)
- actId (int) – Id of the desired activity
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- message (string) – Should be
null
. - title (string) – Should be
null
. - data (json) –
Contains all relevant information about the activity.
See also
ActivitySchema
- JSON schema of the returned activity
Status Codes: - 200 OK – No error
Update an activity
Parameters: - mglId (int) – Member id (not the DPSG Mitgliedsnummer)
- actId (int) – Id of the desired activity
JSON Parameters: - aktivBis (string) – End date of the activity (Format:
YYYY-mm-dd HH:MM:SS
) - aktivVon (string) – Start date of the activity (Format:
YYYY-mm-dd HH:MM:SS
) - beitragsArtId (int) – Id of the fee type (default:
null
). It has not been observed to be anything else thannull
. - caeaGroup (string) – Access rights for the group.
- caeaGroupForGf (string) – Access rights for the sub group.
- caeaGroupId (int) – Corresponsing id for
caeaGroup
. - caeaGroupForGfId (int) – Corresponsing id for
caeaGroupForGf
. - gruppierung (string) – Group Name including its id.
- id (int) – Id of the activity.
- taetigkeit (string) – Type of the activity.
- untergliederung (string) – Department or tier the activity is assciated with.
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- message (string) – Should be
Update successful
. - title (string) – Should be
null
. - data (json) –
Contains all information about the updated activity.
See also
ActivitySchema
- JSON schema of the returned activity
Status Codes: - 200 OK – No error
Default values¶
-
GET
/baseadmin/{key}/
¶ Get default values and their ids from the baseadmin database.
Parameters: - key (string) – Which type of values you want to get. Possible values are
geschlecht
,staatsangehoerigkeit
,konfession
,region
,land
andzahlungskondition
.
Query Parameters: - gruppierung (string) – Group id
- mitglied (string) – Member id (not the DPSG Mitgliedsnummer)
- page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned members
- data (list) –
The search results. Each returned activity is a list entry in the form of a json array.
See also
BaseadminSchema
- JSON schema of the returned data
- metaData (json) – Additional information about the data fields but not on the data itself.
Status Codes: - 200 OK – No error
- key (string) – Which type of values you want to get. Possible values are
Dashboard¶
-
GET
/dashboard/notification-entries/flist
¶ Retrieve all recent notifications.
Query Parameters: - page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
- filterString (string) – The filter attribute (optional). So far only the value
interval
has been observed. - searchString (string) – Search value. If the filter attribute refers to a date the format is
YYYY-mm-dd HH:MM:SS
. For the filterStringinterval
use an integer to view the notifications of the specified number of weeks.
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned members
- data (list) –
The search results. Each returned notification is a list entry in the form of a json array.
See also
NotificationSchema
- JSON schema of the returned notification
- metaData (json) – Additional information about the data fields but not on the activities themselves.
Status Codes: - 200 OK – No error
-
GET
/dashboard/history-entries/flist
¶ Retrieve all recent history entries.
Query Parameters: - page (int) – The page number of result display
- start (int) – Show search results form this index
- limit (int) – Show only up to this many entries
- filterString (string) – The filter attribute (optional). So far only the value
interval
has been observed. - searchString (string) – Search value. If the filter attribute refers to a date the format is
YYYY-mm-dd HH:MM:SS
. For the filterStringinterval
use an integer to view the history entries of the specified number of weeks.
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- totalEntries (int) – Number of returned members
- data (list) –
The search results. Each returned history entry is a list entry in the form of a json array.
See also
HistoryEntrySchema
- JSON schema of the returned history entry
- metaData (json) – Additional information about the data fields but not on the activities themselves.
Status Codes: - 200 OK – No error
-
GET
/dashboard/stats/stats
¶ Get basic statistics about your group
Response JSON Object: - success (boolean) – If everything was ok
- responseType (string) – NaMi response type: Can be
OK
,INFO
,WARN
,ERROR
,EXCEPTION
ornull
- message (string) – Should be
null
. - title (string) – Should be
null
. - data (json) –
Contains the statistical data about your group
See also
StatsSchema
- JSON schema of the statistical data
Status Codes: - 200 OK – No error
Search Mitglieder¶
For validation of the search parameters the following class is used:
-
class
SearchSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Base class for search parameters
You could just use
json.dumps()
on a dictionary to create the search string but this would bypass all the type and spell checking.This also takes care of the miss-spelled search key
'mitgliedsNummber'
so that the user of this API can use the correct spelling.Example
Generate the search string¶from pynami.search import SearchSchema searchKeys = {'vorname': 'Max', 'nachname': 'Mustermann'} searchedValues = SearchSchema().dumps(searchKeys, separators=(',', ':')) print(searchedValues)
Make direct use of the search keys by searching for all Wölflinge and Jungpfadfinder¶from pynami.tools import tabulate2x from pynami.nami import NaMi with NaMi(username='MITGLIEDSNUMMER', password='PASSWORD') as nami: searchResults = nami.search(untergliederungId=[1,2]) print(tabulate2x(searchResults))
-
__model__
¶ alias of
pynami.schemas.base.BaseModel
-
Search Keys¶
-
SearchSchema.
withEndedTaetigkeiten
¶ Whether to search also in activities that have already ended
Type: bool
Restrict search to some group or level¶
There are two way to search only in a specified group or level which are mutually exclusive:
1. Choose the level and specify the group id and/or the group name¶
2. Choose group ids from different levels from a automated list¶
Unused search keys¶
API reference¶
pynami package¶
Subpackages¶
pynami.schemas package¶
Submodules¶
Schemas for activities
-
class
Activity
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Main class for activities directly obtained by their id.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
ActivitySchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for the
Activity
class
-
class
SearchActivity
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Main class for activities wich come up as a search result.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
SearchActivitySchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
SearchActivity
class-
__model__
¶ alias of
SearchActivity
-
This module contains some base classes
-
exception
AccessError
[source]¶ Bases:
AttributeError
-
class
BaseModel
(**kwargs)[source]¶ Bases:
object
Base class for all the main classes.
It stores all data entries as instance attributes.
-
__getstate__
()[source]¶ Enable saving data through pickling
Returns: Returns the __dict__
attribute of the class.Return type: dict
-
__setattr__
(name, value)[source]¶ Set certain fields to read-only
Parameters: - name (str) – Attribute name.
- value – New value.
Raises: AccessError
– In case of invalid write access.Returns:
-
__setstate__
(state)[source]¶ Enable loading data with the
pickle
moduleParameters: state (dict) – Loaded data. Returns: None
-
_field_blacklist
= []¶ Attribute names which are to be skipped while preparing tabulated output
Type: list
-
_tabkeys
= []¶ Default attributes names for tabulating and data export. This attribute is inherited and adapted to all Schema classes from
BaseModel
.Type: list
ofstr
-
table_view
(field_blacklist=None)[source]¶ Prepare nicely formatted output
Parameters: field_blacklist ( list
ofstr
, optional) – List of attributes to be skippedReturns: All data entries which are not in the blacklist Return type: dict
-
tabulate
(elements=None)[source]¶ Prepare ordered tabulated output
Parameters: elements ( list
ofstr
, optional) – List of keys which shall be included in the tableReturns: Specified data entries Return type: OrderedDict
-
-
class
BaseSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
marshmallow.schema.Schema
Base class for all Schemas in this module
It handles the formatting of dates so that the fields in the derived classes can be standard
DateTime
field.Note
This class can not be used on its own but only as a derived class.
-
class
Meta
[source]¶ Bases:
object
This Base Meta class defines the default date and time format.
-
__model__
¶ class: Main class which this Schema is modelling. Each derived class must define this attribute.
alias of
BaseModel
-
_declared_fields
= {}¶
-
_hooks
= {('post_load', False): ['make_object'], ('pre_load', False): ['correctEmptySTrings']}¶
-
correctEmptySTrings
(data, **kwargs)[source]¶ Replace empty strings with
None
This method loops over all fields of the derived Schema class and where it finds a
DateTime
field and an empty string in the datadict
it replaces this value withNone
.To achieve that this is applied before loading this method is decorated with
pre_load()
decorator.Parameters: data (dict) – Data dictionary which is about to be loaded Returns: Adjusted data dictionary Return type: dict
-
make_object
(data, **kwargs)[source]¶ Create the object associated with this Schema by making use of the
post_load()
decorator.Parameters: - data (dict) – Data dictionary containing all keywords and their values
- **kwargs – Possible keyword arguments passed through to this method during the loading procedure.
Returns: Main class correspoding to this Schema
Return type:
-
class
-
class
BaseSearchModel
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Base class for all classes that are loaded from a
BaseSearchSchema
-
_tabkeys
= ['id', 'descriptor']¶
-
-
class
BaseSearchSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Base class for all schemas that describe search results.
All search results share the same three attributes.
-
__model__
¶ alias of
BaseSearchModel
-
_declared_fields
= {'descriptor': <fields.String(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>, 'id': <fields.Raw(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>, 'representedClass': <fields.String(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>}¶
-
_hooks
= {('post_load', False): ['make_object'], ('pre_load', False): ['correctEmptySTrings']}¶
-
descriptor
= None¶ Object description. In some cases the same as
representedClass
.Type: str
-
This module contains classes to handle stuff with the certificates of good conduct.
-
class
Bescheinigung
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Base data class for a certificate about the inspection of a certificate of goos conduct.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.-
download_fz
(nami, **kwargs)[source]¶ Open the certificate as a PDF file
Parameters: - nami (
NaMi
) – Main NaMi class - **kwargs – See
open_download_pdf()
.
Returns: - nami (
-
-
class
BescheinigungSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for the
Bescheinigung
class-
__model__
¶ alias of
Bescheinigung
-
-
class
SearchBescheinigung
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Base data class for a certificate about the inspection of a certificate of goos conduct that came up as a search result.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.-
download_fz
(nami, **kwargs)[source]¶ Open the certificate as a PDF file
Parameters: - nami (
NaMi
) – Main NaMi class - **kwargs – See
open_download_pdf()
.
Returns: - nami (
-
get_bescheinigung
(nami)[source]¶ Create a real
Bescheinigung
form the search result by getting the corresponding data set through the certificate id.Parameters: nami ( NaMi
) – Main NaMi classReturns: The certificate object corresponding to this search result. Return type: Bescheinigung
-
-
class
SearchBescheinigungSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
SearchBescheinigung
class-
__model__
¶ alias of
SearchBescheinigung
-
Schemas for dashboard functionalities
-
class
Notification
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Main class for notification like tier changes of a mitglied.
In the NaMi the notifications are displayed in the dashboard.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
NotificationSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
Notification
class-
__model__
¶ alias of
Notification
-
-
class
StatCatSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for the
StatCategory
class.This only contains the name of the tier and its number of members.
-
__model__
¶ alias of
StatCategory
-
-
class
StatCategory
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Main class for statistical tier numbers.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
Stats
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Main class for basic statistical entries.
The information in this class is displayed in the NaMi dashboard in a pie chart.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
StatsSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for the
Stats
class-
statsCategories
= None¶ Detailed information on the partitions
Type: list
ofStatCategory
-
Schema for default values
-
class
Baseadmin
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Base data class for all default values and their id mapping.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
BaseadminSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
Baseadmin
classAll the default values only consist of the same four attributes
This module contains classes for group admin (Gruppierungsverwaltung) stuff
-
class
Invoice
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Repesents an invoice
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.-
download
(nami, **kwargs)[source]¶ Download this invoice as PDF
Parameters: - nami (
NaMi
) – Main NaMi class - **kwargs – See
open_download_pdf()
.
Returns: - nami (
-
-
class
InvoiceSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for the
Invoice
class
-
class
SearchInvoice
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Repesents an invoice that came up as a search result
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.-
download
(nami, **kwargs)[source]¶ Download this invoice as PDF
Parameters: - nami (
NaMi
) – Main NaMi class - **kwargs – See
open_download_pdf()
.
Returns: - nami (
-
-
class
SearchInvoiceSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
SearchInvoice
class-
__model__
¶ alias of
SearchInvoice
-
Schemas for history entries
-
class
HistoryEntry
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Main class for history entries
This contains information about an update of a Mitglied which is displayed on the NaMi dashbiard.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.-
get_history
(nami, mglId, ext=True)[source]¶ Create a real
MitgliedHistory
form the search result by getting the corresponding data set through the history entry id.Parameters: Returns: The activity object corresponding to this search result.
Return type:
-
-
class
HistoryEntrySchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
HistoryEntry
class-
__model__
¶ alias of
HistoryEntry
Who did this
Type: str
-
entries_mitglied
= None¶ Almost the same as
entries_author
Type: str
-
-
class
MitgliedHistory
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Main class for a member revision history entry obtained directly from its id.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
MitgliedHistorySchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for the
MitgliedHistory
class-
__model__
¶ alias of
MitgliedHistory
-
Schemas for operations on members
-
class
Mitglied
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Main class representing a NaMi Mitglied
This class overwrites the
__getattr__()
and__setattr__()
methods so that attributes of this class can be handled in a convenient way. It is intended to be instantiated by calling theload()
method on a corresponding data dictionary.
-
class
MitgliedSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for a
Mitglied
-
class
Meta
[source]¶ Bases:
pynami.schemas.base.Meta
Extended
marshmallow.Schema.Meta
class for further configuration
-
gruppierungId
= None¶ Group id
Note
In the search result (see
SearchMitgliedSchema
) this comes as astr
.Type: int
-
kontoverbindung
= None¶ Account details. In a search result this comes as a
str
.Type: NamiKontoSchema
-
class
-
class
NamiKonto
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Holds information about bank account and payment method of the member.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
NamiKontoSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for bank account and payment method information.
This Schema will be nested inside a
MitgliedSchema
and there should be no other use for it.-
double_dump
(data, **kwargs)[source]¶ Incoming data sets are nicely formatted
json
strings which can be loaded easily into the Schema but when you update a Mitglied all payment details have to formatted into ajson
string and all attributes have to be in a certain order. To achieve this thepost_dump()
decorator is used.Parameters: data (dict) – Already dumped data set Returns: A json
formatted stringReturn type: str
-
id_to_str
(data, **kwargs)[source]¶ For some reason the NaMi gives the id of the payment details as an
integer
, but when you want to update a member it has be astring
. Therefore this method converts incoming ids to astr
object before loading them by making use of thepre_load()
decorator.Parameters: data (dict) – Data dictionary to be loaded Returns: Corrected data dictionary Return type: dict
-
-
class
SearchMitglied
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Main class for a Mitglied which came up as a search result. Unfortunately there cannot be just one Mitglied class because the search results lack crucal imformation (e.g. payment details).
-
class
SearchMitgliedSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for
SearchMitglied
.For some reason attribute naming in the NaMi is a bit inconsistent between a Mitglied which comes up as a search result and one that is addressed directly by its id.
-
__model__
¶ alias of
SearchMitglied
-
entries_emailVertretungsberechtigter
= None¶ Email address of an authorized representative.
Type: str
-
entries_kontoverbindung
= None¶ Account details. For some reason this is not always transmitted and may therefore be empty.
Type: str
-
This module contains the classes for a search for members
-
class
SearchSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Base class for search parameters
You could just use
json.dumps()
on a dictionary to create the search string but this would bypass all the type and spell checking.This also takes care of the miss-spelled search key
'mitgliedsNummber'
so that the user of this API can use the correct spelling.Example
Generate the search string¶from pynami.search import SearchSchema searchKeys = {'vorname': 'Max', 'nachname': 'Mustermann'} searchedValues = SearchSchema().dumps(searchKeys, separators=(',', ':')) print(searchedValues)
Make direct use of the search keys by searching for all Wölflinge and Jungpfadfinder¶from pynami.tools import tabulate2x from pynami.nami import NaMi with NaMi(username='MITGLIEDSNUMMER', password='PASSWORD') as nami: searchResults = nami.search(untergliederungId=[1,2]) print(tabulate2x(searchResults))
-
class
Meta
[source]¶ Bases:
pynami.schemas.base.Meta
Extended
marshmallow.Schema.Meta
class for further configuration
-
correct_spelling
(data, **kwargs)[source]¶ Check for missspelled or incorrect data before dumping. Realized by the
pre_dump()
decorator.Parameters: data (dict) – Data set to be dumped Returns: Corrected data Return type: dict Raises: KeyError
– When there is a search key that is not an attribute of this class
-
class
Schemas for trainings
-
class
Ausbildung
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseModel
Main class for a training obtained directly from its id.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
-
class
AusbildungSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSchema
Schema class for the
Ausbildung
class-
__model__
¶ alias of
Ausbildung
-
-
class
SearchAusbildung
(**kwargs)[source]¶ Bases:
pynami.schemas.base.BaseSearchModel
Main class for a training obtained as a search result.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.-
get_ausbildung
(nami, mglId)[source]¶ Create a real
Ausbildung
form the search result by getting the corresponding data set through the training id.Parameters: Returns: The activity object corresponding to this search result.
Return type:
-
-
class
SearchAusbildungSchema
(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶ Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
SearchAusbildung
class-
__model__
¶ alias of
SearchAusbildung
-
Schemas for tags
Bases:
pynami.schemas.base.BaseSearchModel
Base data class for a tag that came up as a search result.
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
Bases:
pynami.schemas.base.BaseSearchSchema
Schema class for the
SearchBescheinigung
classalias of
SearchTag
Identity of the member with the DPSG Mitgliedsnummer
Type: str
Actual value of the tag
Type: str
Bases:
pynami.schemas.base.BaseModel
Base data class for a tag
This class is intended to be instantiated by calling the
load()
method on a corresponding data dictionary.
Submodules¶
pynami.constants module¶
This module defines some constants needed for communication with the NaMi.
-
DEFAULT_PARAMS
= {'limit': 10000, 'page': 1, 'start': 0}¶ Default parameters to avoid pagination. The NaMi uses 5000 as limit when using the show all option.
Type: dict
-
class
URLMetaClass
[source]¶ Bases:
type
Meta class for
URLS
Makes the class accessible like a dict and prepends the base url when this is done. The relative URL string can be retrieved in the usual way as attributes.
-
class
URLS
[source]¶ Bases:
object
Contains all relative REST URLs.
The class attributes can be accessed like a dict in order to get the full URL (prepeding the
base URL
). The relative URL strings can be retrieved like normal class attributes.Example
>>> URLS.AUTH '/nami/auth/manual/sessionStartup' >>> URLS['AUTH'] 'https://nami.dpsg.de/ica/rest/nami/auth/manual/sessionStartup'
This is not just a dict so that each URL can be documented.
Note
Some URL strings have to formatted with some variables.
-
ALLE_TAETIGKEITEN
= '/nami/search-multi/all-visible-taetigkeiten'¶
-
AUSBILDUNG
= '/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/'¶
-
AUTH
= '/nami/auth/manual/sessionStartup'¶
-
BAUSTEIN
= '/module/baustein'¶
-
BEANTRAGUNG
= '/fz-beantragen/download-beantragung'¶
-
BEITRAGSART
= '/namiBeitrag/beitragsart/gruppierung/{grpId}/'¶
-
BEITRAGSART_MGL
= '/namiBeitrag/beitragsartmgl/gruppierung/{grpId}/'¶
-
EBENE
= '/orgadmin/ebene/'¶
-
EBENE1
= '/nami/search-multi/ebene/1'¶
-
EBENE2
= '/nami/search-multi/ebene/2/gruppierung1/{grpId}/'¶
-
EBENE3
= '/nami/search-multi/ebene/3/gruppierung2/{grpId}/'¶
-
FZ
= '/nami/fz/eigene-bescheinigungen/'¶
-
GESCHLECHT
= '/baseadmin/geschlecht/'¶
-
GETMGL
= '/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/{gruppierung}/{mitglied}'¶
-
GET_TAG
= '/nami/mitglied-tagged-item/filtered-for-navigation/identitaet/identitaet/{mglId}/{tagId}'¶
-
GRPADMIN_GRPS
= '/nami/gruppierungen-for-grpadmin/parentgruppierung/node/root'¶
-
GRUPPIERUNGEN
= '/nami/gruppierungen/filtered-for-navigation/gruppierung/node/root'¶
-
HISTORY
= '/dashboard/history-entries/flist'¶
-
INVOICE
= '/nami/rechin-for-grpadmin/rechin/gruppierung/'¶
-
INVOICE_PDF
= '/nami/rechin-for-grpadmin/pdf'¶
-
KONFESSION
= '/baseadmin/konfession/'¶
-
LAND
= '/baseadmin/land/'¶
-
LOGOUT
= '/nami/auth/logout'¶
-
MGLTYPE
= '/nami/enum/mgltype'¶
-
MGL_HISTORY
= '/nami/mitglied-history/filtered-for-navigation/mitglied/mitglied/'¶
-
MGL_HISTORY_EXT
= '/nami/mitglied-history-with-values/filtered-for-navigation/mitglied/mitglied/'¶
-
MGL_TAETIGKEITEN
= '/nami/zugeordnete-taetigkeiten/filtered-for-navigation/gruppierung-mitglied/mitglied/'¶
-
NOTIFICATIONS
= '/dashboard/notification-entries/flist'¶
-
REGION
= '/baseadmin/region/'¶
-
SEARCH
= '/nami/search-multi/result-list'¶
-
SEARCH_ALL
= '/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/{gruppierung}/flist'¶
-
SERVER
= ''¶
-
STAAT
= '/baseadmin/staatsangehoerigkeit/'¶
-
STATS
= '/dashboard/stats/stats'¶
-
STATUS_LIST
= '/nami/search-multi/status-list'¶
-
STUFENWECHSEL
= '/mgl-verwaltungS/stufenwechsel'¶
-
TAGLIST
= '//tagging/getTagList'¶
-
TAGS
= '/nami/mitglied-tagged-item/filtered-for-navigation/identitaet/identitaet/{mglId}/flist'¶
-
TK_AUF_GRP
= '//nami/taetigkeitaufgruppierung/filtered/gruppierung/gruppierung/{grpId}/'¶
-
TK_CAEA_GRP
= '//nami/caea-group/filtered-for-navigation/taetigkeit/taetigkeit/{taetigkeitId}/'¶
-
TK_GRP
= '//nami/gf/gruppierung'¶
-
TK_UG
= '//nami/untergliederungauftaetigkeit/filtered/untergliederung/taetigkeit/{taetigkeitId}/'¶
-
UNTERGLIEDERUNG
= '/orgadmin/untergliederung'¶
-
ZAHLUNGSKONDITION
= '/baseadmin/zahlungskondition/'¶
-
pynami.nami module¶
NAMI library in python
This module contains the main class NaMi
and a few simple exception
definitions.
-
class
NaMi
(config={}, **kwargs)[source]¶ Bases:
object
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: NamiHTTPError
– When HTTP communication failesNamiResponseSuccessError
– When the NaMi returns an error
-
_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
orstr
, optional) – Group id - mglId (
int
orstr
, 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: Returns: The returned default values
Return type: - key (
-
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: Returns: The requests session, including the auth cookie
Return type:
-
beitragsarten
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: Each possible fee type
Return type:
-
beitragsarten_mgl
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: Each possible fee for a member
Return type:
-
bescheinigungen
(**kwargs)[source]¶ Get all certificates of inspection
Returns: A list of all your certificates of inspection Return type: list
ofSearchBescheinigung
-
countries
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: List of all possible countries with their names and ids
Return type:
-
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: - id (int) – Internal id of the certificate
- **kwargs – See
open_download_pdf()
.
-
download_invoice
(id_, **kwargs)[source]¶ Downloads and opens an invoice as a pdf document.
Parameters: - id (int) – Id of the invoice (not the regular invoice number)
- **kwargs – See
open_download_pdf()
.
-
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
ofBaseadmin
-
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
ofBaseadmin
-
geschlechter
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: You can choose between three genders: male, female and diverse.
Return type:
-
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:
-
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:
-
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 toTrue
.
Returns: The object containing all vital information about this history entry.
Return type:
-
get_tag
(mglId, tagId)[source]¶ Get a tag by its id
Parameters: Returns: The tag object with all important details
Return type:
-
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
ofBaseadmin
-
gruppierungen
¶ Choose from a list of groups that you are associated with for member admin
Type: list
ofBaseadmin
-
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
ofHistoryEntry
-
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:
-
invoices
(groupId=None, **kwargs)[source]¶ List of all invoices of a group
Parameters: groupId ( int
, optional) – Group idReturns: All invoices of the specified group Return type: list
ofSearchInvoice
-
konfessionen
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: All denominations
Return type:
-
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
ofActivity
-
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
ofSearchAusbildung
-
mgl_history
(mglId, ext=True)[source]¶ Get all history changes from a Mitglied.
Parameters: Returns: All history entries of the member
Return type: list
ofHistoryEntry
-
mgltypes
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: You can have one of three different member types
Return type:
-
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: - mglId (
-
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
ofNotification
-
regionen
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: All possible Bundeslaender
Return type:
-
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
ofSearchMitglied
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 valuesASC
(wich is the default) andDESC
.
Returns: The search results
Return type: - filterString (
-
staaten
(grpId=None, mglId=None)[source]¶ Get default values
Parameters: Returns: A quite long list of different nationalities
Return type:
-
stats
¶ Contains counts from different tiers. The actual list of
StatCategory
is in thestatsCategories
attribute.Type: Stats
-
subdivision
¶ Which division you are associated with. This one is only used for searching.
Type: list
ofBaseadmin
-
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
ofBaseadmin
Get all tags of a member
Parameters: mglId (int) – Member id (not DPSG Mitgliedsnummer) Returns: List of the search results Return type: list
ofSearchTag
-
tk_auf_grp
(grpId, mglId, **kwargs)[source]¶ Get all possible activities for a certain group
Parameters: Returns: List of possible activities
Return type:
-
tk_caea_grp
(grpId, mglId, taetigkeitId, **kwargs)[source]¶ Get all possible access rights for an activity
Parameters: Returns: List of possible access rights
Return type:
-
tk_grp
(grpId, mglId, **kwargs)[source]¶ Get all possible groups for an activity
Parameters: Returns: List of possible groups
Return type:
-
tk_ug
(grpId, mglId, taetigkeitId, **kwargs)[source]¶ Get all possible subdivision for an activity
Parameters: Returns: List of possible subdivision
Return type:
-
update_activity
(mgl, act)[source]¶ Update an activity
Parameters: Returns: A new updated object
Return type: 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: Warning
This has not been tested yet!
-
-
exception
NamiHTTPError
[source]¶ Bases:
Exception
Raised when the HTTP status code was not as expected!
pynami.util module¶
Some utility functions that are used by other classes and methods from this # package but not directly connected to the NaMi.
-
class
ExtractHrefParser
(*, convert_charrefs=True)[source]¶ Bases:
html.parser.HTMLParser
HTML parser for extracting a URL
-
extract_url
(htmlstr)[source]¶ Extract a URL from a HTML string.
Parameters: htmlstr (str) – The HTML string which will be parsed. Returns: The URL Return type: str
-
open_download_pdf
(content, open_file=True, save_file=False, timeout=10, filename='')[source]¶ Open and/or save a downloaded PDF file.
When you only want to open the file: To avoid having to deal with graphical save-the-file dialogues a temporary file inside a temporary directory is created which is deleted after a timeout that is used to open the file. During this timeout the program is blocked.
Parameters: - content (bytes) – Content of the downloaded file
- open_file (
bool
, optional) – Wether to directly open the downloaded file. Defaults toTrue
. - save_file (
bool
, optional) – Wether to save the downloaded file to disc. Defaults toFalse
. - timeout (
float
, optional) – Time the system has for opening the file. Defaults to 10 seconds. - filename (
str
, optional) – Full path to save file
pynami.tools module¶
Some utility functions for user convenience
-
export_xlsx
(data, attrs=None, includeheader=True, tableName='Tabelle1', sheetName='Data', write_to_file=False, filepath='')[source]¶ Create a Microsoft Excel Wokbook from a given dataset. The data can optionally be saved to a file.
Parameters: - data (list) – Data objects. They should all belong to the same class.
- attrs (
list
of str, optional) – Attribute names for the CSV table. If left empty (None
) the value of the first_tabkeys
attribute in the list is taken. - includeheader (
bool
, optional) – Whether to include headers in the output. Defaults toTrue
. - tableName (
str
, optional) – Name of the table. Defaults to ‘Tabelle1’. - sheetName (
str
, optional) – Name of the worksheet. Defaults to ‘Data’. - write_to_file (
bool
, optional) – If the workbook should be saved to a file. Defaults toFalse
. - filepath (
str
, optional) – Full path to the Excel file where the data should be saved. If left empty the default savefile dialog will be invoked via the moduletkinter
.
Returns: The created workbook.
Return type:
-
make_csv
(data, attrs=None, includeheader=True, delimiter=', ')[source]¶ Makes a CSV formatted string from a data set
Parameters: - data (list) – Data objects. They should all belong to the same class.
- attrs (
list
of str, optional) – Attribute names for the CSV table. If left empty (None
) the value of the first_tabkeys
attribute in the list is taken. - includeheader (
bool
, optional) – Whether to include headers in the output. Defaults toTrue
.
Returns: CSV formatted data
Return type:
-
send_emails
(mitglieder, to='', method='bcc', email1=True, email2=True, open_browser=True)[source]¶ Send emails to several members.
Parameters: - mitglieder (list) – The List contents can be either
SearchMitglied
orMitglied
- to (
str
, optional) – Primary recipient - method (
str
, optional) – If you want to send your mails as bcc or something else. Currently only bcc is supported. - email1 (
bool
, optional) – If emails should be send to the primary address of the members. - email2 (
bool
, optional) – If emails should be send to the email account of the member’s parent. - open_browser (
bool
, optional) – IfTrue
the link is opened directly by the system. On a computer this may open your default mail program.
Returns: The mailto link
Return type: - mitglieder (list) – The List contents can be either