Skip to main content

Versioning Caching kinda-Proxy for decoupling external responses

Project description

Buffy

Versioning caching kinda-proxy for decoupling external HTTP resources

Maintainer: Tim Bleimehl

status: alpha (WIP - do not use productive yet)

What is this?

Buffy is a server/client framework to buffer/cache your http requests.
Buffy decouples your dependency on external webservers that are not under your control.
Buffy manages HTTP downloads in the background. You can ignore any issues with external webservers and just focus on your application.
At the moment there is only a Python client but also a REST API for language agnostic use.

Features

  • Versioning of changing downloads
  • Pre-cache long running downloads before you need them
  • Dampen load on external servers - prevent 429 Too Many Requests errors
  • As a "smart" Downloader
    • Resume broken downloads
    • Retry corrupted downloads

At the moment there is only a python client library. But the server has a REST API that can be consumed from any coding language. You are welcome to write a client in your language.

Quick Start Client

Lets have a small example how your Buffy client code could look like.

from buffy.buffypyclient import BuffyPyClient

# connect to buffy server
c = BuffyPyClient(ssl=False)

# create a request
req = c.create_request(
    url="https://ftp.ncbi.nlm.nih.gov/pubmed/baseline/pubmed22n0003.xml.gz"
)

# save requested file
req.download_response_content_to(dir="/tmp")

This is all it takes to request a file. Next time the webserver at ftp.ncbi.nlm.nih.go should be down the buffy client will just serve you the cached answer. Should your Buffy server be down, the client will fall back to direct downloading the request from the source.

See the documenation for more detailed examples on how to use the client

Quick Start Server

Requirements

Server start

  • Download the buffy docker-compose file
wget -O docker-compose.yaml https://git.connect.dzd-ev.de/dzdpythonmodules/buffy/-/raw/main/docker-compose.yaml?inline=false
  • Start the Buffy server with docker compose
docker-compose up -d

Connecting the BuffyPyClient

Create a python script.

# connect to buffy server
from buffy.buffypyclient import BuffyPyClient

# connect to buffy server
c = BuffyPyClient(host="localhost", port=8008, ssl=False)

See the documenation for more detailed examples on how to use the client

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DZDBuffy-0.2.7.tar.gz (357.1 kB view details)

Uploaded Source

Built Distribution

DZDBuffy-0.2.7-py3-none-any.whl (35.6 kB view details)

Uploaded Python 3

File details

Details for the file DZDBuffy-0.2.7.tar.gz.

File metadata

  • Download URL: DZDBuffy-0.2.7.tar.gz
  • Upload date:
  • Size: 357.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for DZDBuffy-0.2.7.tar.gz
Algorithm Hash digest
SHA256 34d29f2657246fb8380ffecfa7840e81ca5adc5b22f300c09327f48f858c0b3b
MD5 79cbb04f6573350018e4d625976b81c7
BLAKE2b-256 8dcc3ae9b1b7e0ca9e7419156f37823c91d56f975085da86c5e0d709ffebd23e

See more details on using hashes here.

File details

Details for the file DZDBuffy-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: DZDBuffy-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 35.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for DZDBuffy-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 14e73b4c23696d4a140e70f22983fd3fe036812116be528e7fe2b20c20a21606
MD5 d39ac570e2c8b0cae3b780f9f2e0aebe
BLAKE2b-256 7a46417d9e8029a2e2c6b477d9beea46d88a29ae53be27008220c81b7d7eedbb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page