code: def get_departures(self, stop_id, route, destination, api_key):
          self.stop_id = stop_id
          self.route = route
          self.destination = destination
          self.api_key = api_key
          url = \
              'https://api.transport.nsw.gov.au/v1/tp/departure_mon?' \
              'outputFormat=rapidJSON&coordOutputFormat=EPSG%3A4326&' \
              'mode=direct&type_dm=stop&name_dm=' \
              + self.stop_id \
              + '&departureMonitorMacro=true&TfNSWDM=true&version=10.2.1.42'
          auth = 'apikey ' + self.api_key
          header = {'Accept': 'application/json', 'Authorization': auth}
          try:
              response = requests.get(url, headers=header, timeout=10)
          except:
              logger.warning("Network or Timeout error")
              return self.info
          if response.status_code != 200:
              logger.warning("Error with the request sent; check api key")
              return self.info
          result = response.json()
          try:
              result['stopEvents']
          except KeyError:
              logger.warning("No stop events for this query")
              return self.info
          maxresults = 1
          monitor = []
          if self.destination != '':
              for i in range(len(result['stopEvents'])):
                  destination = result['stopEvents'][i]['transportation']['destination']['name']
                  if destination == self.destination:
                      event = self.parseEvent(result, i)
                      if event != None:
                          monitor.append(event)
                      if len(monitor) >= maxresults:
                          break
          elif self.route != '':
              for i in range(len(result['stopEvents'])):
                  number = result['stopEvents'][i]['transportation']['number']
                  if number == self.route:
                      event = self.parseEvent(result, i)
                      if event != None:
                          monitor.append(event)
                      if len(monitor) >= maxresults:
                          break
          else:
              for i in range(0, maxresults):
                  event = self.parseEvent(result, i)
                  if event != None:
                      monitor.append(event)
          if monitor:
              self.info = {
                  ATTR_STOP_ID: self.stop_id,
                  ATTR_ROUTE: monitor[0][0],
                  ATTR_DUE_IN: monitor[0][1],
                  ATTR_DELAY: monitor[0][2],
                  ATTR_REALTIME: monitor[0][5],
                  ATTR_DESTINATION: monitor[0][6],
                  ATTR_MODE: monitor[0][7]
                  }
          return self.info