blacken
This commit is contained in:
@@ -50,7 +50,9 @@ WIKIPEDIA_API = "https://en.wikipedia.org/w/api.php"
|
||||
|
||||
# Wikimedia requires a descriptive User-Agent per their policy
|
||||
# https://meta.wikimedia.org/wiki/User-Agent_policy
|
||||
USER_AGENT = "SaintsPictureDownloader/1.0 (Educational project for French saints calendar)"
|
||||
USER_AGENT = (
|
||||
"SaintsPictureDownloader/1.0 (Educational project for French saints calendar)"
|
||||
)
|
||||
|
||||
# Mapping of CSV saint names to alternate Wikipedia article titles to try
|
||||
# Many saints have disambiguation issues or different article naming conventions
|
||||
@@ -67,7 +69,10 @@ ALTERNATE_TITLES = {
|
||||
"Augustine": ["Augustine of Hippo"],
|
||||
"Augustine Zhao Rong and Companions": ["Augustine Zhao Rong"],
|
||||
"Bartholomew": ["Bartholomew the Apostle"],
|
||||
"Basil the Great and Gregory Nazianzen": ["Basil of Caesarea", "Gregory of Nazianzus"],
|
||||
"Basil the Great and Gregory Nazianzen": [
|
||||
"Basil of Caesarea",
|
||||
"Gregory of Nazianzus",
|
||||
],
|
||||
"Bede the Venerable": ["Bede"],
|
||||
"Benedict": ["Benedict of Nursia"],
|
||||
"Bernardine of Siena": ["Bernardino of Siena"],
|
||||
@@ -155,13 +160,15 @@ ALTERNATE_TITLES = {
|
||||
def create_session() -> requests.Session:
|
||||
"""Create a requests session with proper headers for Wikimedia."""
|
||||
session = requests.Session()
|
||||
session.headers.update({
|
||||
"User-Agent": USER_AGENT,
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Connection": "keep-alive",
|
||||
})
|
||||
session.headers.update(
|
||||
{
|
||||
"User-Agent": USER_AGENT,
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Connection": "keep-alive",
|
||||
}
|
||||
)
|
||||
return session
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user