buypeeb/buypeeb.py

38 lines
1.3 KiB
Python
Raw Normal View History

2020-08-10 09:34:24 +00:00
#!/usr/bin/env python
# <one line to give the program's name and a brief idea of what it does.>
# Copyright (C) 2020 lynnesbian
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import requests
from listing import JPItem
import json
def get_exchange_rate():
try:
assert False
return requests.get("https://api.exchangeratesapi.io/latest?base=AUD&symbols=JPY", timeout=10).json()['rates']['JPY']
except:
return 76.15
print("Getting JPY/AUD exchange rate...")
rate = get_exchange_rate()
print(rate)
x = JPItem("My cool product", "peeb.us")
print(f"Bidding for item \"{x.name}\" started at {x.start_date} and will end at {x.end_date}. Current price is {x.price_jpy()}, or {x.price_aud()}.")