Skip to content

Instantly share code, notes, and snippets.

@jamil666
Created August 6, 2019 09:06
Show Gist options
  • Save jamil666/7406b583504c903665b339f021b5e0c2 to your computer and use it in GitHub Desktop.
Save jamil666/7406b583504c903665b339f021b5e0c2 to your computer and use it in GitHub Desktop.
Parsing cbar.az currency and make dictionary with current values
import requests
from bs4 import BeautifulSoup
URL = 'https://www.cbar.az/currency/rates'
response = requests.get(URL)
soup = BeautifulSoup(response.content, 'html.parser')
codes = []
values = []
for code in soup.find_all(class_='kod'):
codes.append(code.text)
for value in soup.find_all(class_='kurs'):
values.append(value.text)
dictionary = dict(zip(codes, values))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment