Commit f2dc13bd7254de843122f04a92f6028d31db8ca2

Authored by mykhaly
1 parent b48736ae

Update get_complaint_internal_id

Now it works with award complaints
... ... @@ -7,8 +7,18 @@ def prepare_api_wrapper(key, host_url, api_version):
7 7 return Client(key, host_url, api_version)
8 8
9 9 def get_complaint_internal_id(tender, complaintID):
10   - for complaint in tender.data.complaints:
11   - if complaint.complaintID == complaintID:
12   - return complaint.id
  10 + try:
  11 + for complaint in tender.data.complaints:
  12 + if complaint.complaintID == complaintID:
  13 + return complaint.id
  14 + except AttributeError:
  15 + pass
  16 + try:
  17 + for award in tender.data.awards:
  18 + for complaint in award.complaints:
  19 + if complaint.complaintID == complaintID:
  20 + return complaint.id
  21 + except AttributeError:
  22 + pass
13 23 raise IdNotFound
14 24
... ...
Please register or login to post a comment