initial
This commit is contained in:
commit
b5bf76908a
32
parser.py
Normal file
32
parser.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import requests
|
||||||
|
import xml.dom.minidom as minidom
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
url = 'https://www.cbr-xml-daily.ru/daily_utf8.xml'
|
||||||
|
r = requests.get(url)
|
||||||
|
root = ET.fromstring(r.content.decode())
|
||||||
|
result = {}
|
||||||
|
for child in root:
|
||||||
|
result[child.find("CharCode").text] = child.find("Value").text
|
||||||
|
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
|
||||||
|
# node = doc.documentElement
|
||||||
|
# names = doc.getElementsByTagName("name")
|
||||||
|
#
|
||||||
|
# my_list = []
|
||||||
|
# for name in names:
|
||||||
|
# titleObj = book.getElementsByTagName("title")[0]
|
||||||
|
# titles.append(titleObj)
|
||||||
|
#
|
||||||
|
# for title in titles:
|
||||||
|
# nodes = title.childNodes
|
||||||
|
# for node in nodes:
|
||||||
|
# if node.nodeType == node.TEXT_NODE:
|
||||||
|
# print(node.data)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
requests
|
Loading…
Reference in New Issue
Block a user