docs

git clone https://github.com/notamitgamer/docs.git
· rebuilt hourlyOpen on GitHub
root / osma / pypi-api.mdx

pypi-api.mdx (2035B)


      1 ---
      2 title: "PyPI API"
      3 ---
      4 
      5 import Copyright from "/snippets/copyright.mdx";
      6 
      7 **Base URL:** `https://notamitgamer-osma-pypi-api.hf.space`
      8 
      9 ## GET /ping
     10 
     11 Uptime check — always returns 200. Lightweight endpoint for UptimeRobot or health monitors; doesn't query the database.
     12 
     13 ```bash
     14 curl https://notamitgamer-osma-pypi-api.hf.space/ping
     15 ```
     16 
     17 ```json
     18 { "ping": "pong" }
     19 ```
     20 
     21 ## GET /health
     22 
     23 Server status + total package count. Returns `200` when the database is ready; returns `503` during cold-start initialization.
     24 
     25 ```bash
     26 curl https://notamitgamer-osma-pypi-api.hf.space/health
     27 ```
     28 
     29 ```json
     30 {
     31   "status": "ok",
     32   "total_packages": 780432
     33 }
     34 ```
     35 
     36 ## GET /stats
     37 
     38 Total package count and dataset source metadata.
     39 
     40 ```bash
     41 curl https://notamitgamer-osma-pypi-api.hf.space/stats
     42 ```
     43 
     44 ```json
     45 {
     46   "total_pypi_packages": 780432,
     47   "source": "pypi.org",
     48   "note": "Snapshot dataset — updated periodically."
     49 }
     50 ```
     51 
     52 ## GET /browse
     53 
     54 Paginated package list, ordered by `package_no`.
     55 
     56 | Parameter | Type | Default | Max | Required | Description |
     57 |---|---|---|---|---|---|
     58 | `page` | integer | 1 | — | optional | Page number, 1-indexed |
     59 | `limit` | integer | 200 | 500 | optional | Rows per page |
     60 
     61 ```bash
     62 curl "https://notamitgamer-osma-pypi-api.hf.space/browse?page=1&limit=5"
     63 ```
     64 
     65 ```json
     66 {
     67   "page": 1,
     68   "limit": 5,
     69   "results": [
     70     { "no": 1, "name": "0", "version": "0.1.0", "url": "https://pypi.org/project/0/" }
     71   ]
     72 }
     73 ```
     74 
     75 ## GET /search
     76 
     77 Ranked search across all packages. `0` = exact match, `1` = starts-with, `2` = contains.
     78 
     79 | Parameter | Type | Default | Max | Required | Description |
     80 |---|---|---|---|---|---|
     81 | `q` | string | — | 100 chars | required | Search query, min 2 characters |
     82 | `limit` | integer | 250 | 500 | optional | Max results to return |
     83 
     84 ```bash
     85 curl "https://notamitgamer-osma-pypi-api.hf.space/search?q=requests&limit=5"
     86 ```
     87 
     88 ```json
     89 {
     90   "query": "requests",
     91   "count": 87,
     92   "results": [
     93     { "no": 512, "name": "requests", "version": "2.31.0", "url": "...", "rank": 0 }
     94   ]
     95 }
     96 ```
     97 
     98 <Copyright />