Skip to content

Commit

Permalink
Merge pull request #4348 from cpinitiative/update-py
Browse files Browse the repository at this point in the history
update script to https
  • Loading branch information
danielzsh committed Feb 29, 2024
2 parents cb85642 + 5d7f5ad commit 6dd281e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import argparse
import json
import urllib.request
import urllib.request, ssl
import os
from typing import Iterable, Optional, Tuple

from bs4 import BeautifulSoup
from loguru import logger

INDEX_PREFIX = "http://www.usaco.org/index.php?page="
DATA_PREFIX = "http://www.usaco.org/current/data/"
INDEX_PREFIX = "https://www.usaco.org/index.php?page="
DATA_PREFIX = "https://www.usaco.org/current/data/"
DIVISIONS = ["Bronze", "Silver", "Gold", "Platinum"]
CONTESTS_SHORT = ["dec", "jan", "feb", "open"]
CONTESTS_LONG = ["December", "January", "February", "US Open"]
YEAR_OFFSETS = [0, 1, 1, 1]


def parse(url: str) -> BeautifulSoup:
page = urllib.request.urlopen(url)
req = urllib.request.Request(url, headers={"User-Agent": "Magic Browser"})
page = urllib.request.urlopen(req)
return BeautifulSoup(page, "html.parser")


Expand Down

0 comments on commit 6dd281e

Please sign in to comment.