Add data for Bulgaria MO

#19
by LxYxvv - opened
Bulgaria_MO/download_script/download.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -----------------------------------------------------------------------------
2
+ # Author: Jiawei Liu
3
+ # Date: 2024-12-18
4
+ # -----------------------------------------------------------------------------
5
+ '''
6
+ Download script for IberoAmerican MO
7
+ To run:
8
+ `python IberoAmerican_MO/download_script/download.py`
9
+ '''
10
+
11
+ import requests
12
+ from tqdm import tqdm
13
+ from pathlib import Path
14
+ from requests.adapters import HTTPAdapter
15
+ from urllib3.util.retry import Retry
16
+
17
+
18
+ def build_session(
19
+ max_retries: int = 3,
20
+ backoff_factor: int = 2,
21
+ session: requests.Session = None
22
+ ) -> requests.Session:
23
+ """
24
+ Build a requests session with retries
25
+
26
+ Args:
27
+ max_retries (int, optional): Number of retries. Defaults to 3.
28
+ backoff_factor (int, optional): Backoff factor. Defaults to 2.
29
+ session (requests.Session, optional): Session object. Defaults to None.
30
+ """
31
+ session = session or requests.Session()
32
+ adapter = HTTPAdapter(max_retries=Retry(total=max_retries, backoff_factor=backoff_factor))
33
+ session.mount("http://", adapter)
34
+ session.mount("https://", adapter)
35
+ session.headers.update({
36
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
37
+ })
38
+
39
+ return session
40
+
41
+
42
+ def main():
43
+ output_dir = Path(__file__).parent.parent / "raw"
44
+ output_dir.mkdir(parents=True, exist_ok=True)
45
+
46
+ urls = {
47
+ "en-1995-2000-BulgarianMO": "https://angelkiller411.wordpress.com/wp-content/uploads/2013/07/bulgarian-mathematical-olympiads-third-and-fourth-rounds-from-1995-to-2000-more-than-300-problems-with-solutions-260p.pdf",
48
+ }
49
+
50
+ for title, url in tqdm(urls.items(), desc="Downloading "):
51
+ response = requests.get(url, headers={"User-Agent": "Mozilla/5.0"})
52
+ output_path = output_dir / f"{title}.pdf"
53
+ output_path.write_bytes(response.content)
54
+
55
+
56
+ if __name__ == "__main__":
57
+ main()
Bulgaria_MO/md/en-1995-2000-BulgarianMO.md ADDED
The diff for this file is too large to render. See raw diff
 
Bulgaria_MO/md/en-BMC_2003-2006.md ADDED
The diff for this file is too large to render. See raw diff
 
Bulgaria_MO/raw/en-1995-2000-BulgarianMO.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:41195428ee1a68f6ed6d12ff5b4925dd0da52edc136c970e1cffa2f81a00e1e8
3
+ size 2571934
Bulgaria_MO/raw/en-BMC_2003-2006.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8366d0d6946a8b942c2fb051d8c727426b5e6eab5b2fb45ad20350e1e6aae7fc
3
+ size 9564059