Skip to main content

REST Countries mock requests: pre-cached per-URL; missing URLs fetched and cached automatically.

Project description

mock-requests-restcountries

A mock for REST Countries (v3.1):

  • Uses packaged JSONs for common URLs
  • If a URL isn't cached, it fetches live once and caches to ~/.cache/mock_requests_rc

Local usage

python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -U pip build
pip install -e ".[dev]"

## Bulk priming

- Prime many URLs into **user cache** (and optionally copy into package data):

```bash
python scripts/bulk_prime.py --urls-file scripts/seed_urls.txt --to-package

Runtime behavior

Resolution order for a URL:

  1. Package data (mock_requests/data/*.json) — fastest
  2. User cache (~/.cache/mock_requests_rc/*.json)
  3. Live fetch then save to user cache
  4. Else: return 404-like mock response

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

mock_requests_restcountries-0.6.0.tar.gz (360.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mock_requests_restcountries-0.6.0-py3-none-any.whl (399.8 kB view details)

Uploaded Python 3

File details

Details for the file mock_requests_restcountries-0.6.0.tar.gz.

File metadata

File hashes

Hashes for mock_requests_restcountries-0.6.0.tar.gz
Algorithm Hash digest
SHA256 b7a629b478961859a15b6bb9a80b7d57b1f37f4909a48b8dea9e74643c83b503
MD5 80b4c765ff20ba78dd188caf082689f2
BLAKE2b-256 9d76ee92974621d26770989d3fe102b6d71df13afbabe9b1ec313d24600df975

See more details on using hashes here.

File details

Details for the file mock_requests_restcountries-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mock_requests_restcountries-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdad3a5716ddcd0b95219c42d9c72edbec6869b6b3f162a31febb3c18a10785a
MD5 db6d4a74920d1cc0165c882a6afbb23d
BLAKE2b-256 9de64fe51ba162de0b47a2546b8800301beef9e51d9c1ce85d059d1ccb2ca4a9

See more details on using hashes here.

Supported by

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