1
0
Fork 0
mirror of https://github.com/SocksPls/hltv-api synced 2025-04-30 15:43:07 +00:00

Update month to name function

Update month to name function to use the existing datetime import
This commit is contained in:
NAme 2022-12-05 03:21:39 +00:00 committed by GitHub
parent a71ccc317e
commit 374c4f1b8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

22
main.py
View file

@ -34,22 +34,12 @@ def _padIfNeeded(numberStr: str):
return str(numberStr) return str(numberStr)
def _monthNameToNumber(monthName: str): def _monthNameToNumber(monthName: str):
months = { # Check for the input "Augu" and convert it to "August"
'January': 1, # This is necessary because the input string may have been sanitized
'February': 2, # by removing the "st" from the day numbers, such as "21st" -> "21"
'March': 3, if monthName == "Augu":
'April': 4, monthName = "August"
'May': 5, return datetime.strptime(monthName, '%B').month
'June': 6,
'July': 7,
'August': 8,
'Augu': 8,
'September': 9,
'October': 10,
'November': 11,
'December': 12
}
return months[monthName]
def get_parsed_page(url, delay=0.5): def get_parsed_page(url, delay=0.5):
# This fixes a blocked by cloudflare error i've encountered # This fixes a blocked by cloudflare error i've encountered