Ejemplo n.º 1
0
# Below description is taken from their website.
# Introduction
# It all starts with the root URL, the routes below are all based around this:

# Retrieving Space Events
# Events are the core purpose of the API. It returns a list of space objects (see below) which are visible from your current location, scored by a likelyhood that it can be seen. A weather object for the start and end of the event is returned.

# Method	Route	Arguments
# GET	/events/all	lat, lon, elevation, limit, date
# GET	/event/<category>	lat, lon, elevation, limit, date
import decimal

from helpers import bowshock_logger, validate_iso8601, validate_float, dispatch_http_get

logger = bowshock_logger()


def space_events(lon=None, lat=None, limit=None, date=None):
    '''
    
    lat & lon expect decimal latitude and longitude values. (Required)
    elevation assumes meters. (Optional)
    limit assumes an integer. Default is 5. (Optional)
    date expects an ISO 8601 formatted date. (Optional)
    '''

    base_url = 'http://api.predictthesky.org/?'

    if not lon or not lat:
        raise ValueError(
Ejemplo n.º 2
0
# http://marsweather.ingenology.com/#get_started

# Below description taken from https://github.com/ingenology/mars_weather_api
# The {MAAS} API is an open source REST API built to help make it easier and more efficient to build interactive applications that want to utilize the wealth of weather data being transmitted by the Curiosity Rover on Mars. Our API is built upon the REMS (Rover Environmental Monitoring Station) data provided by the Centro de Astrobiologia (CSIC-INTA).
# This API is built on Django and Django REST Framework.
# Our implementation of the API is available at marsweather.ingenology.com.
import decimal

from helpers import nasa_api_key, bowshock_logger, vali_date, validate_float, dispatch_http_get

logger = bowshock_logger()


def maas_latest():
    '''
    will return a JSON object for the latest report:

{
    "report": {
        "terrestrial_date": "2013-05-01", 
        "sol": 261, 
        "ls": 310.5, 
        "min_temp": -69.75, 
        "min_temp_fahrenheit": -93.55, 
        "max_temp": -4.48, 
        "max_temp_fahrenheit": 23.94, 
        "pressure": 868.05, 
        "pressure_string": "Higher", 
        "abs_humidity": null, 
        "wind_speed": null, 
        "wind_direction": "--",