RAPP Platform  v0.6.0
RAPP Platform is a collection of ROS nodes and back-end processes that aim to deliver ready-to-use generic services to robots
 All Classes Namespaces Files Functions Variables Macros
weather_reporter_base.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- encode: utf-8 -*-
3 
4 #Copyright 2015 RAPP
5 
6 #Licensed under the Apache License, Version 2.0 (the "License");
7 #you may not use this file except in compliance with the License.
8 #You may obtain a copy of the License at
9 
10  #http://www.apache.org/licenses/LICENSE-2.0
11 
12 #Unless required by applicable law or agreed to in writing, software
13 #distributed under the License is distributed on an "AS IS" BASIS,
14 #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #See the License for the specific language governing permissions and
16 #limitations under the License.
17 
18 # Authors: Aris Thallas
19 # contact: aris.thallas@{iti.gr, gmail.com}
20 
21 
22 import abc
23 
24 from rapp_utilities import RappUtilities
25 from rapp_exceptions import RappError
26 from rapp_http_request_handler import RappHttpRequestHandler
27 from rapp_http_json_parser import RappHttpJSONParser
28 
29 
30 ## @class WeatherReporterBase
31 # @brief Base class for weather reporters
32 class WeatherReporterBase(object):
33 
34  __metaclass__ = abc.ABCMeta
35 
36  ## @brief Constructor
37  def __init__(self):
38  ## The base weather reporter url
39  self._url = ''
40 
41  ## The value of valid response status code
42  self._accepted_status = 200
43 
44  ## Perform http requests to servers
45  self._http_request = RappHttpRequestHandler()
46 
47  ## Strips html tags from strings
48  self.rapp_http_json_parser = RappHttpJSONParser()
49 
50  ## @brief Abstract method to fetch weather report
51  @abc.abstractmethod
52  def fetch_current_weather(self, req):
53  # This must never be printed
54  RappUtilities.rapp_print('Abstract error', 'ERROR')
55 
56  ## @brief Abstract method to fetch weather forecast
57  @abc.abstractmethod
58  def fetch_weather_forecast(self, req):
59  # This must never be printed
60  RappUtilities.rapp_print('Abstract error', 'ERROR')
def fetch_weather_forecast
Abstract method to fetch weather forecast.
def fetch_current_weather
Abstract method to fetch weather report.