Cache (a tiny part of) the internet
Project description
graze
Cache (a tiny part of) the internet.
install
pip install graze
Example
from graze import Graze
import os
rootdir = os.path.expanduser('~/graze')
g = Graze(rootdir)
list(g)
If this is your first time, you got nothing:
[]
So get something. For no particular reason let's be self-referential and get myself:
url = 'https://raw.githubusercontent.com/thorwhalen/graze/master/README.md'
content = g[url]
type(content), len(content)
Before I grew up, I had only 46 petty bytes:
(bytes, 46)
These were:
print(content.decode())
# graze
Cache (a tiny part of) the internet
But now, here's the deal. List your g
keys now. Go ahead, don't be shy!
list(g)
['https://raw.githubusercontent.com/thorwhalen/graze/master/README.md']
What does that mean?
I means you have a local copy of these contents.
The file path isn't really https://...
, it's roodir/https/...
, but you
only have to care about that if you actually have to go get the file with
something else than graze. Because graze will give it to you.
How? Same way you got it in the first place:
content_2 = g[url]
assert content_2 == content
But this time, it didn't ask the internet. It just got it's local copy.
And if you want a fresh copy?
No problem, just delete your local one. You guessed! The same way you would delete a key from a dict:
del g[url]
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
Built Distribution
File details
Details for the file graze-0.0.4.tar.gz
.
File metadata
- Download URL: graze-0.0.4.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fa7a872215b0a4ae9a607aae3e5c56c69e3f145907acb42c851ac0fc3b58d6f |
|
MD5 | 63c78c576cc59ed85091367dd4dd37d4 |
|
BLAKE2b-256 | 2e0e936d589e91397dbab276ce35207128278b69c41bb39f9a3fed2474945ac4 |
File details
Details for the file graze-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: graze-0.0.4-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 579a98f3c45846c0f5df5ffdf5316454bf5bd1afb6d3faacee2c8ac366b7136b |
|
MD5 | eb07966c73c7aa93a3e6289f50dfb6fd |
|
BLAKE2b-256 | 4e4afcd077469ba02383943197959a1a0cee45b94e500e11eb301b1f6b8f0a56 |