Open wkosten opened 2 months ago
Loopen door de response om de documenten op te halen
# Initialize an empty list to store the results
documents_with_parents = []
data = response
# Access 'MeetingItems' safely
meeting = getattr(data, 'Meeting', None)
if meeting:
meeting_items = getattr(meeting, 'MeetingItems', None)
if meeting_items:
iBabs_meeting_items = getattr(meeting_items, 'iBabsMeetingItem', [])
# Loop through 'iBabsMeetingItem'
for item in iBabs_meeting_items:
# Get the parent title and feature
parent_title = getattr(item, 'Title', None)
feature = getattr(item, 'Features', None)
# Get the documents if available
documents = getattr(getattr(item, 'Documents', None), 'iBabsDocument', [])
# Loop through each document and append it to the results list
for document in documents:
documents_with_parents.append({
'ParentTitle': parent_title,
'Feature': feature,
'Document': document
})
# Output the result
for entry in documents_with_parents:
print(f"Parent Title: {entry['ParentTitle']}")
print(f"Feature: {entry['Feature']}")
print(f"Document: {entry['Document']}")
print() # Print a new line for better readability
En de code om de agendapunten op te halen en op volgorde te zetten
# Initialize an empty list to store the features
features_list = []
data = response
# Access 'MeetingItems' safely
meeting = getattr(data, 'Meeting', None)
if meeting:
meeting_items = getattr(meeting, 'MeetingItems', None)
if meeting_items:
iBabs_meeting_items = getattr(meeting_items, 'iBabsMeetingItem', [])
# Loop through 'iBabsMeetingItem'
for item in iBabs_meeting_items:
# Get the feature, title, and explanation
feature = getattr(item, 'Features', None)
title = getattr(item, 'Title', None)
explanation = getattr(item, 'Explanation', None)
# Append to the features list
if feature is not None:
features_list.append({
'Feature': feature,
'Title': title,
'Explanation': explanation
})
# Sort the features list to ensure the parent-child relationship is maintained
features_list.sort(key=lambda x: [int(part) for part in x['Feature'].split('.')])
# Build the parent-child relationship
for feature in features_list:
feature_number = feature['Feature']
parts = feature_number.split('.')
# If it has a minor part, find its parent
if len(parts) > 1:
major = parts[0]
parent_feature_number = major
# Look for the parent in the list
parent = next((f for f in features_list if f['Feature'] == parent_feature_number), None)
if parent:
feature['Parent'] = parent_feature_number
else:
feature['Parent'] = None
else:
# No minor part means it is a major feature (top-level)
feature['Parent'] = None
# Output the result
for feature in features_list:
print(f"Feature: {feature['Feature']}")
print(f"Parent: {feature['Parent']}")
print(f"Title: {feature['Title']}")
print(f"Explanation: {feature['Explanation']}")
print() # Print a new line for better readability
POC maken (Python worker) voor ophalen van documenten uit iBabs agenda's op basis van SOAP API
Beschrijving iBabs Public WCF Service-2-1.pdf
https://wcf.ibabs.eu/api/Public.svc https://wcf.ibabs.eu/api/Public.svc?singleWsdl
PHP Drupal code: https://gitlab.com/digitalemedia/drupal_core/-/blob/master/sites/all/modules/custom/zl_deployment/services/class.ibabs_soap.inc?ref_type=heads
Python code voor ophalen meetingtypes:
En het resultaat:
Meetings met geselecteerde opties