Ejemplo n.º 1
0
    def _get_meetings(self, committee_id, from_date, to_date):
        try:
            meetings = DataserviceCommitteeMeeting.get(committee_id, from_date, to_date)
            return meetings
        except Exception as e:
            err_msg = ERR_MSG.format(committee_id)
            err_msg_report = ERR_MSG_REPORT.format(committee_id, str(e))
            DataserviceCommitteeMeeting.error_report(err_msg, err_msg_report)
            self._log_error(err_msg)

        return []
Ejemplo n.º 2
0
 def update_from_dataservice(self, dataservice_object=None):
     from committees.management.commands.scrape_committee_meetings import Command as ScrapeCommitteeMeetingCommand
     from knesset_data.dataservice.committees import CommitteeMeeting as DataserviceCommitteeMeeting
     if dataservice_object is None:
         ds_meetings = [
             ds_meeting for ds_meeting
             in DataserviceCommitteeMeeting.get(self.committee.knesset_id, self.date - timedelta(days=1), self.date + timedelta(days=1))
             if str(ds_meeting.id) == str(self.knesset_id)
         ]
         if len(ds_meetings) != 1:
             raise Exception('could not found corresponding dataservice meeting')
         dataservice_object = ds_meetings[0]
     meeting_transformed = ScrapeCommitteeMeetingCommand().get_committee_meeting_fields_from_dataservice(dataservice_object)
     [setattr(self, k, v) for k,v in meeting_transformed.iteritems()]
     self.save()
Ejemplo n.º 3
0
 def _get_meetings(self, committee_id, from_date, to_date):
     try:
         meetings = DataserviceCommitteeMeeting.get(committee_id, from_date, to_date)
         return meetings
     except Exception as e:
         err_msg = ERR_MSG.format(committee_id)
         err_msg_report = ERR_MSG_REPORT.format(committee_id, str(e))
         DataserviceCommitteeMeeting.error_report(err_msg, err_msg_report)
         self._log_error(err_msg)
         send_chat_notification(__name__,
                                "Received unexpected exception from DataServiceCommitteeMeeting.get()",
                                {'exception': traceback.format_exc(),
                                 'committee_id': committee_id,
                                 'from_date': from_date,
                                 'to_date': to_date})
     return []
 def _get_meetings(self, committee_id, from_date, to_date):
     try:
         meetings = DataserviceCommitteeMeeting.get(committee_id, from_date, to_date)
         return meetings
     except KnessetDataServiceRequestException as e:
         err_msg = ERR_MSG.format(committee_id)
         err_msg_report = ERR_MSG_REPORT.format(committee_id, str(e))
         DataserviceCommitteeMeeting.error_report(err_msg, err_msg_report)
         self._log_error(err_msg)
         send_chat_exception_notification(__name__,
                                "Failed to fetch from committee meetings knesset dataservice",
                                {'committee_id': committee_id,
                                 'from_date': from_date,
                                 'to_date': to_date,
                                 'url': e.url}, e)
     return []
Ejemplo n.º 5
0
 def _get_meetings(self, committee_id, from_date, to_date):
     try:
         meetings = DataserviceCommitteeMeeting.get(committee_id, from_date,
                                                    to_date)
         return meetings
     except KnessetDataServiceRequestException as e:
         err_msg = ERR_MSG.format(committee_id)
         err_msg_report = ERR_MSG_REPORT.format(committee_id, str(e))
         DataserviceCommitteeMeeting.error_report(err_msg, err_msg_report)
         self._log_error(err_msg)
         send_chat_exception_notification(
             __name__,
             "Failed to fetch from committee meetings knesset dataservice",
             {
                 'committee_id': committee_id,
                 'from_date': from_date,
                 'to_date': to_date,
                 'url': e.url
             }, e)
     return []
Ejemplo n.º 6
0
 def _get_meetings(self, committee_id, datetime_from, datetime_to):
     # the knesset dataservice allows to get meetings only using a function with these parameters
     # see https://github.com/hasadna/knesset-data/issues/25
     return CommitteeMeeting.get(committee_id, datetime_from, datetime_to)
Ejemplo n.º 7
0
 def _committee_meeting_get(self, committee_id, fromdate, proxies):
     return CommitteeMeeting.get(committee_id, fromdate, proxies=proxies)