Klubbadmin - ka module¶
KA class¶
A simple class to interface KA
Login done with PassBuy
Access the KA webpages programatically
Read and write support
-
class
nif_tools.ka.
KA
(username, password, realm='ka', email_recepients=[])[source]¶ Bases:
object
-
approve_application_ended
(inboxline, refund=True)[source]¶ Approve the cancellation - 1 application a time, or?
Will it refund invoices? :parameter dict inboxline: one item from get_applications_ended :parameter boolean refund: if to refund invoices or not, default True :returns boolean result: result of approval
-
check_person_activities_org
(org_id, activities)[source]¶ Returns true if acitivity org in application org
-
get_age
(person_id)[source]¶ Get person from ka, calculate age by calendar year
- Parameters
person_id (int) – Person Id
- Returns int age
Person age by calendar year
-
get_applications
()[source]¶ Get membership applications
These are the applications by the members themselves
- Returns int
http status code
- Returns list
list of inbox items = applications
-
get_inbox_ended
()[source]¶ Get inbox items for applications for ending membership
- Returns list
inbox list of current applications to cancel membership(s)
-
get_person
(person_id, remove=True)[source]¶ Get person from ka
- Parameters
person_id (int) – Person Id
- Returns int status
http code
- Returns dict person
person
-
get_person_orgs
(person_id)[source]¶ Return orgs
p[‘MembershipOrgSelectionViewModel’][‘FederationClubSelectionViewModel’].keys() dict_keys([‘ClubList’, ‘ExistingClubs’, ‘PassiveClubs’, ‘NewClubOrgId’, ‘ExistingFederationFunctionFromDate’, ‘ReturnToIndex’, ‘ReturnUrl’])
-
req
(r)[source]¶ Just parse the request object
- Parameters
r (requests) – requests response object
- Returns int, dict status_code, requests.json
-
requests_html
(url, params, key1, key2=None, remove_keys=[], pre_pad='', post_pad='')[source]¶ Gets html page and returns json from jquery
-
sanitize_person_products
(person_id, products, org_id=None, tandem=False)[source]¶ Sanitizes products by checking correct according to organization and if is tandem
-
save_person_activities
(org_id, selected_activities)[source]¶ We process the selected in select_person_activities
-
save_person_products
(products)[source]¶ Save persons products
- Parameters
products (dict) – products from get_person_products, should be sanitized in sanitize_products
- Returns int status
- Returns dict result
-
select_person_activities
(person_id, org_id, activities)[source]¶ Select the club/org_id to get activities which we then can save later
-