Skip to main content


Python - Currency Converter using Free API | No API Key needed | OpenSource

Refer this video for demo:-



URL_1 - https://exchangeratesapi.io/
API_1 - https://api.exchangeratesapi.io/latest?base=USD

URL_2 - https://www.exchangerate-api.com/
API_2 - https://api.exchangerate-api.com/v4/latest/USD


Source Code:-


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
##Program Description:- Currency Converter
##Dev:- Joel Dcosta
##JSON API :- https://api.exchangeratesapi.io/latest?base=USD
##URL OPENSOURCE :- exchangeratesapi.io

json_url = "https://api.exchangeratesapi.io/latest?base=USD"

import urllib.request as r
import json

response = r.urlopen(json_url)
data = json.loads(response.read().decode(response.info().get_param('charset') or 'utf-8'))
##Specify what data you like to view
array = data['rates']
#print(list(array)[20])
x = list(array)
#print(x)
## 0 - 32
#print(x[26]) = USD

#n = 0
#for i in x:
       #example
       #usd = array.get(x[26])
       #i=array.get(x[n])
       #print(i+"= array.get(x["+str(n)+"])")
       #n = n + 1

CAD= array.get(x[0])
HKD= array.get(x[1])
ISK= array.get(x[2])
PHP= array.get(x[3])
DKK= array.get(x[4])
HUF= array.get(x[5])
CZK= array.get(x[6])
GBP= array.get(x[7])
RON= array.get(x[8])
SEK= array.get(x[9])
IDR= array.get(x[10])
INR= array.get(x[11])
BRL= array.get(x[12])
RUB= array.get(x[13])
HRK= array.get(x[14])
JPY= array.get(x[15])
THB= array.get(x[16])
CHF= array.get(x[17])
EUR= array.get(x[18])
MYR= array.get(x[19])
BGN= array.get(x[20])
TRY= array.get(x[21])
CNY= array.get(x[22])
NOK= array.get(x[23])
NZD= array.get(x[24])
ZAR= array.get(x[25])
USD= array.get(x[26])
MXN= array.get(x[27])
SGD= array.get(x[28])
AUD= array.get(x[29])
ILS= array.get(x[30])
KRW= array.get(x[31])
PLN= array.get(x[32])

def conv(rate, _to, _from):
       #print(1000*USD / INR)
       print(rate *  _from /  _to)



🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍

Popular Posts

Python underline string, Python underline text, Underline python print

Python pip - Installing modules from IDLE (Pyton GUI) for python 3.7

Top 40 Python - String Processing in Python | Working with String in Python

Top 11 Essential Python Tips and Tricks

Python Program - When was I born? / Date of Birth / MY BIRTHDAY (using Python3+)





Subscribe to our Channel


Follow us on Facebook Page

Join our python facebook groups



Join us on Telegram