Created
April 29, 2013 17:14
-
-
Save polyrabbit/5483111 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# coding:utf-8 | |
__version__ = '1.0' | |
__author__ = 'phus.lu@gmail.com' | |
import sys | |
import os | |
def remote_import(name, url): | |
import sys, urllib2 | |
text = urllib2.urlopen(url).read() | |
module = sys.modules[name] = type(sys)(name) | |
module.__dict__['__file__'] = url | |
codeobj = compile(text, filename=url, mode='exec') | |
exec codeobj in module.__dict__ | |
return module | |
def main(): | |
wsgi = remote_import('wsgi', 'https://raw.github.com/goagent/goagent/2.0/server/python/wsgi.py') | |
print wsgi | |
print dir(wsgi) | |
if __name__ == '__main__': | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment