Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib.request
- #url w img ==> https://prnt.sc/gh5555
- #url w/out img ==> https://prnt.sc/12abce
- # Request with Header Data to send User-Agent header
- url = 'https://prnt.sc/12abce'
- # gets past servers programmmic access ban
- headers = {}
- headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'
- #headers['Content-Type'] = 'application/json'
- #requesting the html
- request = urllib.request.Request(url, headers=headers)
- resp = urllib.request.urlopen(request)
- #copies the html and converts response from bytes to a string
- byteResp = resp.read()
- dataStr = str(byteResp, 'utf-8')
- #prints the html as a string
- print(dataStr)
Add Comment
Please, Sign In to add comment