Created
December 21, 2016 08:08
-
-
Save jwlin/b6063fddff863b8e9405e519d38c3c9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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