Beispiel #1
0
 def __init__(self,
              network,
              contract,
              api_key,
              operators={'jcdecaux'},
              timeout=10,
              feed_publisher=DEFAULT_JCDECAUX_FEED_PUBLISHER,
              **kwargs):
     self.network = network.lower()
     self.contract = contract
     self.api_key = api_key
     self.operators = [o.lower() for o in operators]
     self.timeout = timeout
     fail_max = kwargs.get('circuit_breaker_max_fail',
                           app.config['CIRCUIT_BREAKER_MAX_JCDECAUX_FAIL'])
     reset_timeout = kwargs.get(
         'circuit_breaker_reset_timeout',
         app.config['CIRCUIT_BREAKER_JCDECAUX_TIMEOUT_S'])
     self.breaker = pybreaker.CircuitBreaker(fail_max=fail_max,
                                             reset_timeout=reset_timeout)
     self._feed_publisher = FeedPublisher(
         **feed_publisher) if feed_publisher else None
Beispiel #2
0
 def __init__(self,
              instance,
              service_url,
              modes=[],
              id='geovelo',
              timeout=10,
              api_key=None,
              feed_publisher=DEFAULT_GEOVELO_FEED_PUBLISHER,
              **kwargs):
     self.instance = instance
     self.sn_system_id = id
     if not is_url(service_url):
         raise ValueError(
             'service_url {} is not a valid url'.format(service_url))
     self.service_url = service_url
     self.api_key = api_key
     self.timeout = timeout
     self.modes = modes
     self.breaker = pybreaker.CircuitBreaker(
         fail_max=app.config['CIRCUIT_BREAKER_MAX_GEOVELO_FAIL'],
         reset_timeout=app.config['CIRCUIT_BREAKER_GEOVELO_TIMEOUT_S'])
     self._feed_publisher = FeedPublisher(
         **feed_publisher) if feed_publisher else None
Beispiel #3
0
 def feed_publisher(self):
     return FeedPublisher(id='mock', name='mock provider')
Beispiel #4
0
 def feed_publisher(self):
     return FeedPublisher(id='mock_bss',
                          name=self.name,
                          license='the death license',
                          url='bob.com')
Beispiel #5
0
 def feed_publisher(self):
     return FeedPublisher(id='mock_car_park',
                          name=self.name,
                          license='license to kill',
                          url='MI.6')
Beispiel #6
0
        def __init__(self, url, operators, dataset, timeout=1, feed_publisher=DEFAULT_DIVIA_FEED_PUBLISHER, **kwargs):

            self._feed_publisher = FeedPublisher(**feed_publisher) if feed_publisher else None
            self.provider_name = 'DIVIA'

            super(_DiviaProvider, self).__init__(url, operators, dataset, timeout, **kwargs)