Allow importing files through the web, by adding urls to pythonpath
Project description
[ urlimport.py ]
Enables remote module importing through urllib2 and perforce.
author: Jure Vrscaj <jure@codeshift.net>
last contributed versions:
version: 0.72c (myevan <myevan_net@naver.com> fixes and improvements)
version: 0.85b (alex <alexbodn@012.net.il> fixes and improvements)
version: 0.72d (jure <jure@codeshift.net> found a bug and alex fixed it).
homepage: http://urlimport.codeshift.net
license: MIT
download: all the project's files may be downloaded from bitbucket with hg:
hg clone http://bitbucket.org/alexbodn/urlimport
Usage:
import sys, urlimport
urlimport.config(**{
'ssl_key.https://your.url':'key for this url'
'ssl_cert.https://your.url':'cert for this url',
'opener.https://your.url':'opener for this url',
'cache_time.http://your.url':'timedelta to keep files in cache for this url',
'no_cache.url':True, # don't cache modules from this url
'user_agent.url':'user agent header for this url',
'ssl_key.host':'key for this host'
'ssl_cert.host':'cert for this host',
'opener.host':'opener for this host',
'cache_time.host':'timedelta to keep files in cache for this host',
'no_cache.host':True, # don't cache modules from this host
'user_agent.host':'user agent header for this host',
'ssl_key':'key for unspecified urls',
'ssl_cert':'cert for unspecified urls',
'opener':'opener for unspecified urls',
'no_cache':'True, #don't cache modules for unspecified urls
'user_agent':'user agent header for unspecified urls',
'cache_time':'timedelta to keep files in cache for unspecified urls',
#if cache_time is missing, keep forever, but check last_modified and etag
'cache_dir':'root of the cache dir', # if missing, a temp dir will be created,
# if empty, no cache will be used
'py_version_string': '$PYTHON_VERSION', # string in path to be replaced by
# $major.$minor
'debug': int(level of output text. see debug() function)
})
# note: if you supply your own opener, i'd recommand inheriting/implementing the
# status handling features from class DefaultErrorHandler below.
sys.path.insert(0, "http://your.url") #this may already be there, like setting
#PYTHONPATH
#but there is a danger default import
#would try it before
expect to have access to your modules at http://your.url
TODO:
- check what's mpath all about.
TODO later:
- python 3.1 support. preliminary work done
- url import of zipped modules
- support of other urls, like ssh, svn, hg, bzr, cvs etc.
- reload c extensions. well, they don't allways reload in local import either,
but my module does reload locally, so why not remotely?
introspection will help.
- swithch the usage of debug with some logging, and do some cleanup of the
calls.
Enables remote module importing through urllib2 and perforce.
author: Jure Vrscaj <jure@codeshift.net>
last contributed versions:
version: 0.72c (myevan <myevan_net@naver.com> fixes and improvements)
version: 0.85b (alex <alexbodn@012.net.il> fixes and improvements)
version: 0.72d (jure <jure@codeshift.net> found a bug and alex fixed it).
homepage: http://urlimport.codeshift.net
license: MIT
download: all the project's files may be downloaded from bitbucket with hg:
hg clone http://bitbucket.org/alexbodn/urlimport
Usage:
import sys, urlimport
urlimport.config(**{
'ssl_key.https://your.url':'key for this url'
'ssl_cert.https://your.url':'cert for this url',
'opener.https://your.url':'opener for this url',
'cache_time.http://your.url':'timedelta to keep files in cache for this url',
'no_cache.url':True, # don't cache modules from this url
'user_agent.url':'user agent header for this url',
'ssl_key.host':'key for this host'
'ssl_cert.host':'cert for this host',
'opener.host':'opener for this host',
'cache_time.host':'timedelta to keep files in cache for this host',
'no_cache.host':True, # don't cache modules from this host
'user_agent.host':'user agent header for this host',
'ssl_key':'key for unspecified urls',
'ssl_cert':'cert for unspecified urls',
'opener':'opener for unspecified urls',
'no_cache':'True, #don't cache modules for unspecified urls
'user_agent':'user agent header for unspecified urls',
'cache_time':'timedelta to keep files in cache for unspecified urls',
#if cache_time is missing, keep forever, but check last_modified and etag
'cache_dir':'root of the cache dir', # if missing, a temp dir will be created,
# if empty, no cache will be used
'py_version_string': '$PYTHON_VERSION', # string in path to be replaced by
# $major.$minor
'debug': int(level of output text. see debug() function)
})
# note: if you supply your own opener, i'd recommand inheriting/implementing the
# status handling features from class DefaultErrorHandler below.
sys.path.insert(0, "http://your.url") #this may already be there, like setting
#PYTHONPATH
#but there is a danger default import
#would try it before
expect to have access to your modules at http://your.url
TODO:
- check what's mpath all about.
TODO later:
- python 3.1 support. preliminary work done
- url import of zipped modules
- support of other urls, like ssh, svn, hg, bzr, cvs etc.
- reload c extensions. well, they don't allways reload in local import either,
but my module does reload locally, so why not remotely?
introspection will help.
- swithch the usage of debug with some logging, and do some cleanup of the
calls.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
urlimport-0.86c-dev.tar.gz
(29.4 kB
view details)
Built Distribution
urlimport-0.86c_dev-py2.5.egg
(19.1 kB
view details)
File details
Details for the file urlimport-0.86c-dev.tar.gz
.
File metadata
- Download URL: urlimport-0.86c-dev.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53f6aee0ebbe4af6db09ceab7935531f20dba3b7284ad6f12da4cc89b37105b3 |
|
MD5 | ee27bfbc2779d93dbc525db3b97ed783 |
|
BLAKE2b-256 | a29da737dc77058917fd19095adfdd65fe420124a56e8ce33d986b420c92e241 |
File details
Details for the file urlimport-0.86c_dev-py2.5.egg
.
File metadata
- Download URL: urlimport-0.86c_dev-py2.5.egg
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1896ce11ac272c40ac423937b518ba3725da6e2c91e8bd05b5364e9612e8aff |
|
MD5 | b73ec57278a44d3695709325e053db94 |
|
BLAKE2b-256 | a10f52850cef03d1d0c3931b5e136ee197932eda421d71555c12ea85e9682298 |