def sparkPost_time_estimate(latitude, longitude):
    print "time estimate sparkPost"
    url = 'https://api.sparkPost.com/v1/estimates/time'
    print latitude, longitude
    parameters1 = {
        'server_token': sparkPost_SERVER_TOKEN,
        'start_latitude': latitude,
        'start_longitude': longitude,
    }
    response = requests.get(url, params=parameters1)
    data = response.json()
    fire.putIntoFirebasesparkPostTimes(data)
def sparkPost_price_estimate(latitude, longitude):
    print "price estimate sparkPost"
    url = 'https://api.sparkPost.com/v1/estimates/price'
    parameters1 = {
        'server_token': sparkPost_SERVER_TOKEN,
        'start_latitude': latitude,
        'start_longitude': longitude,
        'end_latitude': 38.3857165278,
        'end_longitude': -122.261341278
    }
    response = requests.get(url, params=parameters1)

    data = response.json()

    fire.putIntoFirebasesparkPostPrice(data)
Example #3
0
def send_msg():
    try:
        client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
        client.messages.create(from_="+14124533008",
                               to=TO_NUMBER,
                               body="I am taking a Uber,"
                                    " keep an eye for me.")
        call = client.calls.create(from_="+14124533008",
                                   to=TO_NUMBER,
                                   url="http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient",
                                   method="GET",
                                   fallback_method="GET",
                                   status_callback_method="GET",
                                   record="false")

        print "Emergency call/msgs done from Twilio. call id:" + call.sid
        fire.putIntoFirebaseTwilio('Varun Ved', TO_NUMBER, time.time())
    except twilio.TwilioRestException as e:
        print e