isoc-ams 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of isoc-ams might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: isoc-ams
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A Python 3 module to cope with ISOC-AMS.
5
5
  Author-email: Klaus Birkenbihl <klaus.birkenbihl@isoc.de>
6
6
  Maintainer: Klaus Birkenbihl
@@ -13,7 +13,7 @@ Project-URL: Home, https://github.com/birkenbihl/isoc-ams
13
13
 
14
14
  # isoc-ams
15
15
 
16
- A Python Interface to access the 'Advanced Members Administration System' (AMS) of the 'Internet Society' (ISOC). This is especially useful for ISOC Chapter Admins who want to synchronize their Chapter Database with AMS (semi)automatically.
16
+ A Python Interface to access the 'Advanced Members Administration System' (AMS) of the 'Internet Society' (ISOC). This is especially useful for ISOC Chapter Admins who want to synchronize their own Chapter Database with AMS (semi)automatically.
17
17
 
18
18
  After 10 years+ of sorrow, millions minutes of waiting for answers from the AMS web interface, tons of useless clicks, many (in fact) rejected requests to provide an API access: the author decided to build an API himself. Even if it might not be more than a demonstrator for the functionality needed. Anyhow (see below): for now it is running on a weekly basis doing a great job in avoiding manual work.
19
19
 
@@ -43,8 +43,20 @@ Don't forget: it takes time and you may see many kinds of errors. Often the cure
43
43
  Anyhow, after running it some time now it seems to work better than expected.
44
44
  So here we go:
45
45
 
46
- ## Installation
46
+ ## Preparing
47
+ ### Prerequisites
48
+ isoc-ams was tested under Linux (Ubuntu 22.04) and Windows 11.
47
49
 
50
+ **While rather stable under Linux, Windows 11 produced mixed results. Under powershell you may need to set the ExecutionPolicy**
51
+ ```
52
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
53
+ ```
54
+
55
+ Firefox or Chrome Webbrowser with Webdriver (usually included) is required.
56
+
57
+ A full installation of Python 3.9+ is required.
58
+
59
+ ### Installation
48
60
  Install (or update) isoc-ams with pip.
49
61
 
50
62
  ```bash
@@ -71,9 +83,9 @@ Output:
71
83
  Username:xyz
72
84
  Password:
73
85
 
74
- *************************************
75
- 2025-07-13 19:25:54 - INFO - START
76
- *************************************
86
+ ***********************************************************
87
+ 2025-07-13 19:25:54 - INFO - START: Webdriver is firefox
88
+ ***********************************************************
77
89
 
78
90
  2025-07-13 19:25:54 - INFO - logging in
79
91
 
@@ -86,9 +98,9 @@ OK, probably your fault. After fixing:
86
98
  Username: xxx
87
99
  Password:
88
100
 
89
- *************************************
90
- 2025-07-13 19:26:27 - INFO - START
91
- *************************************
101
+ ***********************************************************
102
+ 2025-07-13 19:26:27 - INFO - START: Webdriver is firefox
103
+ ***********************************************************
92
104
 
93
105
  2025-07-13 19:26:27 - INFO - logging in
94
106
  2025-07-13 19:26:45 - INFO - Now on Chapter Leader portal
@@ -143,9 +155,9 @@ Output:
143
155
  Username: xxx
144
156
  Password:
145
157
 
146
- ********************************************
147
- 2025-07-15 10:35:57 - INFO - START DRYRUN
148
- ********************************************
158
+ ******************************************************************
159
+ 2025-07-15 10:35:57 - INFO - START DRYRUN: Webdriver is firefox
160
+ *****************************************************************
149
161
 
150
162
  2025-07-15 10:35:57 - INFO - logging in
151
163
  2025-07-15 10:36:12 - INFO - Now on Chapter Leader portal
@@ -202,9 +214,9 @@ isoc_ams unleashes its full power when used as API to make things happen without
202
214
  Here the output:
203
215
  ```
204
216
 
205
- *************************************
206
- 2025-07-15 14:13:36 - INFO - START
207
- *************************************
217
+ ***********************************************************
218
+ 2025-07-15 14:13:30 - INFO - START: Webdriver is firefox
219
+ ***********************************************************
208
220
 
209
221
  2025-07-15 14:13:36 - INFO - logging in
210
222
  2025-07-15 14:13:53 - INFO - Now on Chapter Leader portal
@@ -286,6 +298,6 @@ Thank you,
286
298
 
287
299
  Your ISOC.DE MAS support team
288
300
 
289
- See file [isoc_ams.html](https://github.com/birkenbihl/isoc-ams/blob/main/isoc_ams.html) for doc on the API interface.
301
+ See file [isoc_ams.html](https://html-preview.github.io/?url=https://github.com/birkenbihl/isoc-ams/blob/main/isoc_ams.html) for doc on the API interface.
290
302
 
291
303
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  # isoc-ams
3
3
 
4
- A Python Interface to access the 'Advanced Members Administration System' (AMS) of the 'Internet Society' (ISOC). This is especially useful for ISOC Chapter Admins who want to synchronize their Chapter Database with AMS (semi)automatically.
4
+ A Python Interface to access the 'Advanced Members Administration System' (AMS) of the 'Internet Society' (ISOC). This is especially useful for ISOC Chapter Admins who want to synchronize their own Chapter Database with AMS (semi)automatically.
5
5
 
6
6
  After 10 years+ of sorrow, millions minutes of waiting for answers from the AMS web interface, tons of useless clicks, many (in fact) rejected requests to provide an API access: the author decided to build an API himself. Even if it might not be more than a demonstrator for the functionality needed. Anyhow (see below): for now it is running on a weekly basis doing a great job in avoiding manual work.
7
7
 
@@ -31,8 +31,20 @@ Don't forget: it takes time and you may see many kinds of errors. Often the cure
31
31
  Anyhow, after running it some time now it seems to work better than expected.
32
32
  So here we go:
33
33
 
34
- ## Installation
34
+ ## Preparing
35
+ ### Prerequisites
36
+ isoc-ams was tested under Linux (Ubuntu 22.04) and Windows 11.
35
37
 
38
+ **While rather stable under Linux, Windows 11 produced mixed results. Under powershell you may need to set the ExecutionPolicy**
39
+ ```
40
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
41
+ ```
42
+
43
+ Firefox or Chrome Webbrowser with Webdriver (usually included) is required.
44
+
45
+ A full installation of Python 3.9+ is required.
46
+
47
+ ### Installation
36
48
  Install (or update) isoc-ams with pip.
37
49
 
38
50
  ```bash
@@ -59,9 +71,9 @@ Output:
59
71
  Username:xyz
60
72
  Password:
61
73
 
62
- *************************************
63
- 2025-07-13 19:25:54 - INFO - START
64
- *************************************
74
+ ***********************************************************
75
+ 2025-07-13 19:25:54 - INFO - START: Webdriver is firefox
76
+ ***********************************************************
65
77
 
66
78
  2025-07-13 19:25:54 - INFO - logging in
67
79
 
@@ -74,9 +86,9 @@ OK, probably your fault. After fixing:
74
86
  Username: xxx
75
87
  Password:
76
88
 
77
- *************************************
78
- 2025-07-13 19:26:27 - INFO - START
79
- *************************************
89
+ ***********************************************************
90
+ 2025-07-13 19:26:27 - INFO - START: Webdriver is firefox
91
+ ***********************************************************
80
92
 
81
93
  2025-07-13 19:26:27 - INFO - logging in
82
94
  2025-07-13 19:26:45 - INFO - Now on Chapter Leader portal
@@ -131,9 +143,9 @@ Output:
131
143
  Username: xxx
132
144
  Password:
133
145
 
134
- ********************************************
135
- 2025-07-15 10:35:57 - INFO - START DRYRUN
136
- ********************************************
146
+ ******************************************************************
147
+ 2025-07-15 10:35:57 - INFO - START DRYRUN: Webdriver is firefox
148
+ *****************************************************************
137
149
 
138
150
  2025-07-15 10:35:57 - INFO - logging in
139
151
  2025-07-15 10:36:12 - INFO - Now on Chapter Leader portal
@@ -190,9 +202,9 @@ isoc_ams unleashes its full power when used as API to make things happen without
190
202
  Here the output:
191
203
  ```
192
204
 
193
- *************************************
194
- 2025-07-15 14:13:36 - INFO - START
195
- *************************************
205
+ ***********************************************************
206
+ 2025-07-15 14:13:30 - INFO - START: Webdriver is firefox
207
+ ***********************************************************
196
208
 
197
209
  2025-07-15 14:13:36 - INFO - logging in
198
210
  2025-07-15 14:13:53 - INFO - Now on Chapter Leader portal
@@ -274,5 +286,5 @@ Thank you,
274
286
 
275
287
  Your ISOC.DE MAS support team
276
288
 
277
- See file [isoc_ams.html](https://github.com/birkenbihl/isoc-ams/blob/main/isoc_ams.html) for doc on the API interface.
289
+ See file [isoc_ams.html](https://html-preview.github.io/?url=https://github.com/birkenbihl/isoc-ams/blob/main/isoc_ams.html) for doc on the API interface.
278
290
 
@@ -85,8 +85,12 @@ CHANGELOG
85
85
  Version 0.1.0
86
86
  Improved logging
87
87
  minor bug fixes
88
+ Version 0.1.1
89
+ minor bug fixes
90
+ Version 0.1.2
91
+ eliminate not required checks in difference_from_expected()
88
92
  """
89
- __version__ = "0.1.0"
93
+ __version__ = "0.1.2"
90
94
 
91
95
  from selenium import webdriver
92
96
  from selenium.webdriver.common.by import By
@@ -232,13 +236,13 @@ ARGUMENTS
232
236
  _init_logging(logfile, debuglog)
233
237
  self._ams = _ISOC_AMS()
234
238
  if self._dryrun:
235
- strong_msg("START DRYRUN")
239
+ strong_msg("START DRYRUN:", "Version:", __version__, "Webdriver is", _dr)
236
240
  else:
237
- strong_msg("START")
241
+ strong_msg("START:", "Version:", __version__, "Webdriver is", _dr)
238
242
  self._ams.login((user, password))
239
243
  self._members_list = self._ams.build_members_list()
240
244
  self._pending_applications_list = self._ams.build_pending_applicants_list()
241
-
245
+ self.approve_list = self.delete_list = self.deny_list = None
242
246
 
243
247
  @property
244
248
  def members_list(self) -> dict:
@@ -298,6 +302,7 @@ ARGUMENTS
298
302
  """
299
303
  if type(delete_list) in (str, int):
300
304
  delete_list = [delete_list]
305
+ self.delete_list = delete_list
301
306
  for deletee in map(str, delete_list):
302
307
  if deletee in self._members_list:
303
308
  deletee = str(deletee)
@@ -325,6 +330,7 @@ ARGUMENTS
325
330
  """
326
331
  if type(approve_list) in (int, str):
327
332
  approve_list = [approve_list]
333
+ self.approve_list = approve_list
328
334
  for approvee in map(str, approve_list):
329
335
  if approvee in self._pending_applications_list:
330
336
  if approvee not in self._members_list:
@@ -358,6 +364,7 @@ ARGUMENTS
358
364
  """
359
365
  if type(deny_list) in (str, int):
360
366
  deny_list = [deny_list],
367
+ self.deny_list = deny_list
361
368
  for denyee in map(str, deny_list):
362
369
  if denyee in self._pending_applications_list:
363
370
  if not self._dryrun:
@@ -404,29 +411,36 @@ RETURNS
404
411
  not_deleted = {}
405
412
  not_approved = {}
406
413
  not_removed_from_pending = {}
407
- new_members_list = self._ams.build_members_list()
414
+
415
+ if self.approve_list or self.delete_list:
416
+ new_members_list = self._ams.build_members_list()
417
+ if self.deny_list or self.approve_list:
418
+ new_pending_applications_list = self._ams.build_pending_applicants_list()
419
+
408
420
  dlog("Check members list")
409
- for nm in new_members_list:
410
- if nm not in self._members_list:
411
- dlog(new_members_list[nm]["first name"],
412
- new_members_list[nm]["last name"],
413
- "("+nm+")",
414
- "was not deleted")
415
- not_deleted[nm] = new_members_list[nm]
416
- for nm in self._members_list:
417
- if nm not in new_members_list:
418
- dlog(self._members_list[nm]["first name"],
419
- self._members_list[nm]["last name"],
420
- "("+nm+")",
421
- "was not approved")
422
- not_approved[nm] = self._members_list[nm]
423
- new_pending_applications_list = self._ams.build_pending_applicants_list()
424
- for np in new_pending_applications_list:
425
- if np not in self._pending_applications_list:
426
- dlog(self._members_list[nm]["name"],
427
- "("+nm+")",
428
- "was not removed from pending aoolications")
429
- not_removed_from_pending[np] = new_pending_applications_list[np]
421
+ if self.delete_list:
422
+ for nm in new_members_list:
423
+ if nm not in self._members_list:
424
+ dlog(new_members_list[nm]["first name"],
425
+ new_members_list[nm]["last name"],
426
+ "("+nm+")",
427
+ "was not deleted")
428
+ not_deleted[nm] = new_members_list[nm]
429
+ if self.approve_list:
430
+ for nm in self._members_list:
431
+ if nm not in new_members_list:
432
+ dlog(self._members_list[nm]["first name"],
433
+ self._members_list[nm]["last name"],
434
+ "("+nm+")",
435
+ "was not approved")
436
+ not_approved[nm] = self._members_list[nm]
437
+ if self.deny_list:
438
+ for np in new_pending_applications_list:
439
+ if np not in self._pending_applications_list:
440
+ dlog(self._members_list[nm]["name"],
441
+ "("+nm+")",
442
+ "was not removed from pending aoolications")
443
+ not_removed_from_pending[np] = new_pending_applications_list[np]
430
444
 
431
445
  result = {}
432
446
  if not_deleted:
@@ -943,8 +957,8 @@ if __name__ == "__main__":
943
957
  password,
944
958
  headless=headless,
945
959
  dryrun=dryrun,
946
- logfile=None,
947
- debuglog=sys.stderr,
960
+ logfile=sys.stdout,
961
+ debuglog=None,
948
962
  )
949
963
  else:
950
964
  ams = ISOC_AMS(
File without changes
File without changes