Skip to content

Commit 5cfb957

Browse files
committed
Update URL
1 parent 9111c3b commit 5cfb957

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

main.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,23 @@
44
import codecs
55
import pandas as pd
66
from bs4 import BeautifulSoup
7-
from datetime import datetime
87

9-
urlpath = "https://cbr.ru/vfs/mcirabis/BIKNew/"
10-
filename = datetime.now().strftime('%Y%m%d') + "ED01OSBR.zip"
118
outdir = "output/"
12-
outzip = outdir + filename
139

1410
s = cloudscraper.create_scraper(disableCloudflareV1=True, browser="chrome", delay=10)
1511

1612
for _ in range(3):
17-
r = s.get(urlpath + filename, allow_redirects=True)
13+
r = s.get("https://cbr.ru/s/newbik", allow_redirects=True)
1814
if r.status_code != 200:
1915
print(f"Error downloading zip: {r.status_code}")
2016
continue
21-
open(outzip, "wb").write(r.content)
17+
open("latest.zip", "wb").write(r.content)
2218
break
2319

2420
try:
25-
with zipfile.ZipFile(outzip, 'r') as zr:
21+
with zipfile.ZipFile("latest.zip", "r") as zr:
2622
zr.extractall(outdir)
27-
os.remove(outzip)
23+
os.remove("latest.zip")
2824
except Exception as e:
2925
print(f"Error unpacking file: {e}")
3026
exit(1)

0 commit comments

Comments
 (0)