Skip to content

Instantly share code, notes, and snippets.

@calebmadrigal
Last active December 16, 2015 22:08
Show Gist options
  • Save calebmadrigal/5504352 to your computer and use it in GitHub Desktop.
Save calebmadrigal/5504352 to your computer and use it in GitHub Desktop.
Function to get the PythonAnywhere gist viewer for a given gist file.
import urllib2
def get_raw_gist(raw_gist_url):
return urllib2.urlopen(raw_gist_url).read()
def python_anywhere_gist_url(gist_num, gist_file, py_version="python2"):
return "https://www.pythonanywhere.com/gists/{0}/{1}/{2}".format(gist_num, gist_file, py_version)
print get_raw_gist("https://gist.github.com/calebmadrigal/5504352/raw/pythonanywhere_gist.py")
print python_anywhere_gist_url(5504352, "pythonanywhere_gist.py")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment