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.5.0.tar.gz (314.5 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.5.0-py3-none-any.whl (351.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for mock_requests_restcountries-0.5.0.tar.gz
Algorithm Hash digest
SHA256 58d44a5a3c3662de3eed018ebd5a892101f0583fdf5b3ba1a088b79644cb4336
MD5 8cc201b44486ab157d52148bdd17cf0d
BLAKE2b-256 3bb079a516485d7ab5774da5863c101eca887f4058eb1f042a4e7a218d683faa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mock_requests_restcountries-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b05557852ff258acbad0ac891436965e9ffff774f61576ab906d9b4d48d1e90d
MD5 7dea81b49dcfd86a0c2c8575c7b63267
BLAKE2b-256 d92246629eb7ad1c021d9c1dd278019bae56c221cc96e6c3aa25c4f212898845

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