Commit b29f8569 authored by Stephane Mankowski's avatar Stephane Mankowski

Source rateapi doesn't work in appimage

parent d90cb8a7
skrooge (2.23.0)
*Correction: cryptocompare fails if too many values are requested (>2000)
*Correction: Change icon for trackers by a "crosshairs"
*Correction: Source ratesapi doesn't work in appimage
*Feature: Add new source "exchangeratesapi.io"
-- Stephane MANKOWSKI <stephane@mankowski.fr> NotPlannedYet
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#**************************************************************************
#* Copyright (C) 2017 by S. MANKOWSKI / G. DE BURE support@mankowski.fr
#* Copyright (C) 2020 by S. MANKOWSKI / G. DE BURE support@mankowski.fr
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted provided that the following conditions
#* are met:
......@@ -24,14 +24,16 @@
#* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#**************************************************************************
import requests
import urllib.request
import json
import sys
import time
args = sys.argv[1].split('/')
url = 'https://api.ratesapi.io/api/latest?base='+args[0]+'&symbols='+args[1]
f = json.loads(requests.get(url).text)
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
f = urllib.request.urlopen(req)
print("Date,Price")
print(f["date"]+","+str(f["rates"][args[1]]))
data = json.loads(f.read().decode('utf-8'))
print(data["date"]+","+str(data["rates"][args[1]]))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment