Last active
December 16, 2015 22:08
-
-
Save calebmadrigal/5504352 to your computer and use it in GitHub Desktop.
Function to get the PythonAnywhere gist viewer for a given gist file.
This file contains 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 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