What I do in Python 3.13:
opener = urllib.request.URLopener() opener.addheader('User-Agent', 'Mozilla/5.0') opener.open(URL).read()
BasedPyright hates me for this - when it really shouldn't.