Skip to content

Instantly share code, notes, and snippets.

@jwlin
Created December 21, 2016 08:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwlin/b6063fddff863b8e9405e519d38c3c9f to your computer and use it in GitHub Desktop.
Save jwlin/b6063fddff863b8e9405e519d38c3c9f to your computer and use it in GitHub Desktop.
import requests
def get_web_page(url):
resp = requests.get(
url=url,
cookies={'over18': '1'}
)
if resp.status_code != 200:
print('Invalid url:', resp.url)
return None
else:
return resp.text
if __name__ == '__main__':
page = get_web_page('https://www.ptt.cc/bbs/Beauty/index.html')
if page:
print(page)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment