Last active
December 12, 2016 14:55
-
-
Save LAMike310/772fbff87a4d7840661104bb3f24fbc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from two1.wallet import Wallet | |
from two1.bitrequests import BitTransferRequests | |
# set up bitrequest client for BitTransfer requests | |
wallet = Wallet() | |
requests = BitTransferRequests(wallet) | |
# server address | |
server_url = 'http://[::1]:5000/' | |
def getEstimate(): | |
# get the question from the server | |
response = requests.get(url=server_url+'start') | |
startAddressText = response.text | |
ogStart = input(startAddressText) | |
response = requests.get(url=server_url+'getEndAddress') | |
startAddressText = response.text | |
ogEnd = input(startAddressText) | |
print("Hold on tight, we are searching 20 possible routes for the best price...") | |
print("") | |
url = "https://kdszo9c85m.execute-api.us-west-2.amazonaws.com/prod/21-scip" | |
r = requests.post(url, json={ "originalAddress": ogStart, "targetDestination": ogEnd }) | |
response = r.json() | |
print("**********************") | |
if 'errorMessage' not in response: | |
start_address = response['start_address'] | |
end_address = response['end_address'] | |
discount = response['discount'] | |
price = response['price'] | |
if discount == '0.00': | |
print('Your in the perfect location for a ride! We did not find any better rates.') | |
print("") | |
else: | |
print("") | |
print("Here is the best route, you can save $%s" %(discount)) | |
print("Depart from %s" % (start_address)) | |
print("Arrive at %s" % (end_address)) | |
print("Current price for this route is $%s" % (price)) | |
print("") | |
else: | |
print("π© π© π© π© π© π© π©") | |
print("") | |
print(response['errorMessage']) | |
print("") | |
print("π΅ π΅ π΅ π΅ π΅ π΅ π΅") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment