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.7.0.tar.gz (359.9 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.7.0-py3-none-any.whl (399.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for mock_requests_restcountries-0.7.0.tar.gz
Algorithm Hash digest
SHA256 04688a1ddf508787d01b31e46d153134f260d9f4167b97328e70ae41ae40f43b
MD5 21958f74d291123cee4027c1ff002b33
BLAKE2b-256 3f22b6a1a338785cb2830a83824f2b5edf290da16794f6a5dfe54b095d924603

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mock_requests_restcountries-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b7aa3bbb1c63c86bd712fd2cdd3903fa67601cc0eabd087df9a939bdc613aee
MD5 a6d0f411a32774b1f95004edcac44b2e
BLAKE2b-256 987771ac96aea4ad17ccbaeb99e20ae341c2dbfba98ff2a614df843934353d68

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