Accessing and caching remote data.
Project description
remotedata
Accessing and caching remote data for python. May be used in the cases that:
- The remote data is being updated frequently
- You don't want to sync all the data but just per your request
- You want to cache the data locally for some time
- Especially, when the files are used for testing
Installation
pip install remotedata
Usage
Currently, data from github
and dropbox
are supported
Github
from remotedata import remotedata
rdata = remotedata(dict(
source = 'github',
cachedir = '/tmp/cached/',
## if branch is not master: pwwang/remotedata/branch
repos = 'pwwang/remotedata',
## optional, default is first part of repos
# user = 'pwwang',
## github token, in case you have > 60 requests per hours to github API
# token = 'xxx',
))
readme = rdata.get('README.md')
# README.md is downloaded to /tmp/cache/github/pwwang.remotedata@master/README.md
# Now you can use it as a local file
# readme will be cached, we don't have to download it again,
# until it has been changed remotely.
# remove cached file
rdata.remove('README.md')
# clear up all caches
rdata.clear()
Dropbox
from remotedata import remotedata
rdata = remotedata(dict(
source = 'dropbox',
cachedir = '/tmp/cached/',
dropbox_token = 'xxx'
))
rdata.get('/somefile') # or
rdata.get('somefile')
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
remotedata-0.1.0.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for remotedata-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb06895d3954df687e50ae5b47d7070f3de451fe2c2d0c1ecd532ab22a6c0fe9 |
|
MD5 | dcf64f62affff63cf52821647197299d |
|
BLAKE2b-256 | d332fb64fef1a6c27d9451555039dff2e870b269117510826b08fac8a08dee85 |