def on_error(self, status_code, data):
        print(status_code)
        disconnect()


stream = MyStreamer(consumer_key, consumer_secret,access_token,access_token_secret)

#Biscaya
#[[[-3.4492757,42.9818774],[-3.4492757,43.4568551],[-2.4128145,43.4568551],[-2.4128145,42.9818774],[-3.4492757,42.9818774]]]
#stream.statuses.filter(locations=[-3.4492757,42.9818774,-2.4128145,43.4568551])
#All spain
box=BoundingBox()
box.lat_min=float(config["GEOLOCATION"]["SPAIN_MIN_LAT"])
box.lat_max=float(config["GEOLOCATION"]["SPAIN_MAX_LAT"])
box.lon_min=float(config["GEOLOCATION"]["SPAIN_MIN_LON"])
box.lon_max=float(config["GEOLOCATION"]["SPAIN_MAX_LON"])
stream.statuses.filter(locations=[box.lon_min, box.lat_min, box.lon_max, box.lat_max])
stream.statuses.filter(replies=all)
#Enable Count in IBM server
#stream.statuses.filter(count=50000)


"""
Rest API
from twython import Twython
twitter = Twython()

api_url = 'https://api.twitter.com/1.1/search/tweets.json'
constructed_url = twitter.construct_api_url(api_url, q='python',
result_type='popular')
    def on_error(self, status_code, data):
        print(status_code)
        disconnect()


stream = MyStreamer(consumer_key, consumer_secret, access_token,
                    access_token_secret)

#Biscaya
#[[[-3.4492757,42.9818774],[-3.4492757,43.4568551],[-2.4128145,43.4568551],[-2.4128145,42.9818774],[-3.4492757,42.9818774]]]
#stream.statuses.filter(locations=[-3.4492757,42.9818774,-2.4128145,43.4568551])
#All spain
box = BoundingBox()
box.lat_min = float(config["GEOLOCATION"]["SPAIN_MIN_LAT"])
box.lat_max = float(config["GEOLOCATION"]["SPAIN_MAX_LAT"])
box.lon_min = float(config["GEOLOCATION"]["SPAIN_MIN_LON"])
box.lon_max = float(config["GEOLOCATION"]["SPAIN_MAX_LON"])
stream.statuses.filter(
    locations=[box.lon_min, box.lat_min, box.lon_max, box.lat_max])
stream.statuses.filter(replies=all)
#Enable Count in IBM server
#stream.statuses.filter(count=50000)
"""
Rest API
from twython import Twython
twitter = Twython()

api_url = 'https://api.twitter.com/1.1/search/tweets.json'
constructed_url = twitter.construct_api_url(api_url, q='python',
result_type='popular')
print constructed_url