async def update(self) -> None:
        """Get the latest data from api.entur.org."""
        headers = {'ET-Client-Name': self._client_name}
        request = {
            'query': self.get_gql_query(),
            'variables': {
                'stops': self.stops,
                'quays': self.quays,
                'whitelist': {
                    'lines': self.line_whitelist
                },
                'numberOfDepartures': self.number_of_departures,
                'omitNonBoarding': self.omit_non_boarding
            }
        }

        with async_timeout.timeout(10):
            resp = await self.web_session.post(RESOURCE,
                                               json=request,
                                               headers=headers)

        if resp.status != 200:
            _LOGGER.error(
                "Error connecting to Entur, response http status code: %s",
                resp.status)
            return None

        result = await resp.json()

        if 'errors' in result:
            _LOGGER.warning("Entur API responded with error message: {error}",
                            result['errors'])
            return

        self._data = result['data']

        if 'stopPlaces' in self._data:
            for stop in self._data['stopPlaces']:
                self._process_place(stop, False)

        if 'quays' in self._data:
            for quay in self._data['quays']:
                self._process_place(quay, True)
async def update ( self ) -> None : headers = { 'ET-Client-Name' : self . _client_name } request = { 'query' : self . get_gql_query ( ) , 'variables' : { 'stops' : self . stops , 'quays' : self . quays , 'whitelist' : { 'lines' : self . line_whitelist } , 'numberOfDepartures' : self . number_of_departures , 'omitNonBoarding' : self . omit_non_boarding } } with async_timeout . timeout ( 10 ) : resp = await self . web_session . post ( RESOURCE , json = request , headers = headers ) if resp . status != 200 : _LOGGER . error ( "Error connecting to Entur, response http status code: %s" , resp . status ) return None result = await resp . json ( ) if 'errors' in result : _LOGGER . warning ( "Entur API responded with error message: {error}" , result [ 'errors' ] ) return self . _data = result [ 'data' ] if 'stopPlaces' in self . _data : for stop in self . _data [ 'stopPlaces' ] : self . _process_place ( stop , False ) if 'quays' in self . _data : for quay in self . _data [ 'quays' ] : self . _process_place ( quay , True )
Get the latest data from api.entur.org.