Skip to content

Instantly share code, notes, and snippets.

@natanielstrack
Last active July 18, 2016 03:03
Show Gist options
  • Save natanielstrack/def9cf131dfb7e5a65e6a7bc705b7d26 to your computer and use it in GitHub Desktop.
Save natanielstrack/def9cf131dfb7e5a65e6a7bc705b7d26 to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
try:
resp =requests.get("https://www.python.org/dev/peps/pep-0020/")
if resp.status_code == 200:
soup = BeautifulSoup(resp.content, 'html.parser')
print soup.pre.string
print "(server version)"
else:
raise Exception, "Zen not found"
except Exception:
import this
print "(local version)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment