roast-api 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +21 -0
- package/README.md +43 -1
- package/api/bn/roasts-bn-1.json +602 -2
- package/api/en/roasts-en-1.json +602 -2
- package/composer.json +30 -0
- package/index.html +73 -1
- package/load_test.js +72 -0
- package/package.json +1 -1
- package/pyproject.toml +32 -0
- package/roast_api/__init__.py +29 -0
- package/roast_api/__pycache__/__init__.cpython-312.pyc +0 -0
- package/roast_api/__pycache__/client.cpython-312.pyc +0 -0
- package/roast_api/client.py +89 -0
- package/src/RaaS.php +133 -0
|
@@ -28,3 +28,24 @@ jobs:
|
|
|
28
28
|
files: |
|
|
29
29
|
api/client.js
|
|
30
30
|
postman/roast-as-a-service.postman_collection.json
|
|
31
|
+
|
|
32
|
+
publish-pypi:
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v4
|
|
36
|
+
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: '3.x'
|
|
40
|
+
|
|
41
|
+
- name: Install build tools
|
|
42
|
+
run: pip install build twine
|
|
43
|
+
|
|
44
|
+
- name: Build package
|
|
45
|
+
run: python -m build
|
|
46
|
+
|
|
47
|
+
- name: Publish to PyPI
|
|
48
|
+
run: twine upload dist/*
|
|
49
|
+
env:
|
|
50
|
+
TWINE_USERNAME: __token__
|
|
51
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
<p align="center">
|
|
7
7
|
<img src="https://hits.sh/maijied.github.io/roast-as-a-service.svg?view=today-total&style=flat-square&label=visitors&color=ec4899&labelColor=020617" alt="Visitor Count" />
|
|
8
8
|
<a href="https://www.npmjs.com/package/roast-api"><img src="https://img.shields.io/npm/v/roast-api?style=flat-square&color=f97316&labelColor=020617" alt="npm version" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/roast-api"><img src="https://img.shields.io/npm/dm/roast-api?style=flat-square&color=ec4899&labelColor=020617" alt="npm downloads" /></a>
|
|
10
|
+
<a href="https://pypi.org/project/roast-api/"><img src="https://img.shields.io/pypi/v/roast-api?style=flat-square&color=3b82f6&labelColor=020617" alt="PyPI version" /></a>
|
|
11
|
+
<a href="https://packagist.org/packages/maizied/roast-api"><img src="https://img.shields.io/packagist/v/maizied/roast-api?style=flat-square&color=10b981&labelColor=020617" alt="Packagist version" /></a>
|
|
12
|
+
<a href="https://github.com/Maijied/roast-as-a-service/actions/workflows/deploy.yml"><img src="https://github.com/Maijied/roast-as-a-service/actions/workflows/deploy.yml/badge.svg" alt="Deploy to GitHub Pages" /></a>
|
|
9
13
|
</p>
|
|
10
14
|
|
|
11
15
|
Random developer roasts, delivered via a blazing‑fast static API on GitHub Pages. Plug it into your apps, bots, terminals, or CI logs when “nice error messages” just aren’t enough.
|
|
@@ -64,7 +68,31 @@ Load the client SDK directly in your browser:
|
|
|
64
68
|
</script>
|
|
65
69
|
```
|
|
66
70
|
|
|
67
|
-
### 3.
|
|
71
|
+
### 3. Install via Composer (PHP)
|
|
72
|
+
```bash
|
|
73
|
+
composer require maizied/roast-api
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```php
|
|
77
|
+
use Maizied\RoastApi\RaaS;
|
|
78
|
+
|
|
79
|
+
$roast = RaaS::getRandomRoast(['lang' => 'en']);
|
|
80
|
+
echo $roast['text'];
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 4. Install via pip (Python)
|
|
84
|
+
```bash
|
|
85
|
+
pip install roast-api
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from roast_api import get_random_roast
|
|
90
|
+
|
|
91
|
+
roast = get_random_roast(lang='en')
|
|
92
|
+
print(roast['text'])
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 5. Direct Fetch
|
|
68
96
|
Or just fetch the JSON files directly:
|
|
69
97
|
|
|
70
98
|
```javascript
|
|
@@ -159,6 +187,20 @@ Key points:
|
|
|
159
187
|
|
|
160
188
|
This combination (static JSON + sharding + client‑side logic + CDN caching) is effectively the “fast path” that many dynamic APIs end up approximating with layers of caching—here it’s the default.
|
|
161
189
|
|
|
190
|
+
## ⚡ Performance & Benchmarks
|
|
191
|
+
|
|
192
|
+
RaaS is built for extreme speed and low overhead. By sharding data and relying on CDN edge caching + local browser caching, it achieves massive throughput.
|
|
193
|
+
|
|
194
|
+
**Latest Benchmark Results:**
|
|
195
|
+
- **Requests/sec**: ~2,000 (Tested with 5,000 total requests)
|
|
196
|
+
- **Success Rate**: 100% (Zero failures under high concurrency)
|
|
197
|
+
- **Avg Latency**: ~58ms
|
|
198
|
+
- **P95 Latency**: ~159ms
|
|
199
|
+
- **Cache Efficiency**: 90%+ (Manifest and shard reuse)
|
|
200
|
+
|
|
201
|
+
> [!TIP]
|
|
202
|
+
> This "Static API" approach beats the latency of traditional dynamic APIs by removing backend processing, cold starts, and database queries from the request path.
|
|
203
|
+
|
|
162
204
|
---
|
|
163
205
|
|
|
164
206
|
## 🐛 More from Lorapok
|