Skip to content

Commit 79048f0

Browse files
committed
Update docs
1 parent e1fbcf5 commit 79048f0

7 files changed

Lines changed: 478 additions & 173 deletions

File tree

docs/configuration.html

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,72 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Configuration &mdash; RMP Client</title>
77
<link rel="stylesheet" href="style.css" />
8+
<link id="hljs-theme" rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/styles/github-dark.min.css" />
9+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/highlight.min.js"></script>
10+
<script>
11+
(function(){var t=localStorage.getItem('rmp-docs-theme');var d=t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme:dark)').matches);if(d)document.documentElement.classList.add('dark')})();
12+
</script>
813
</head>
914
<body>
15+
<header class="topbar">
16+
<div class="topbar-right">
17+
<a href="https://github.com/amaanjaved1/Rate-My-Professors-API-Client" class="topbar-btn" target="_blank" rel="noopener" aria-label="GitHub">
18+
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/></svg>
19+
</a>
20+
<button class="topbar-btn" id="theme-toggle" aria-label="Toggle theme"></button>
21+
</div>
22+
</header>
23+
1024
<aside class="sidebar">
11-
<div class="sidebar-brand"><span class="dot"></span>RMP Client</div>
12-
<nav>
13-
<ul>
14-
<li><a href="index.html">Home</a></li>
15-
<li><a href="usage.html">Usage</a></li>
16-
<li><a href="reference.html">API Reference</a></li>
17-
<li><a href="configuration.html" class="active">Configuration</a></li>
18-
<li><a href="extras.html">Extras</a></li>
19-
</ul>
20-
</nav>
25+
<div class="sidebar-brand">RMP API Docs</div>
26+
<nav><ul>
27+
<li><a href="index.html">Home</a></li>
28+
<li><a href="usage.html">Usage</a></li>
29+
<li><a href="reference.html">API Reference</a></li>
30+
<li><a href="configuration.html" class="active">Configuration</a></li>
31+
<li><a href="extras.html">Extras</a></li>
32+
</ul></nav>
2133
</aside>
2234

2335
<main class="content">
2436
<h1>Configuration</h1>
2537
<p>The client is configured via <code>RMPClientConfig</code>. All fields have sensible defaults.</p>
26-
27-
<pre><code>from rmp_client import RMPClientConfig, RMPClient
38+
<pre><code class="language-python">from rmp_client import RMPClientConfig, RMPClient
2839

2940
config = RMPClientConfig(
3041
base_url="https://www.ratemyprofessors.com/graphql",
3142
timeout_seconds=10.0,
3243
max_retries=3,
3344
rate_limit_per_minute=60,
3445
)
35-
3646
with RMPClient(config) as client:
3747
...</code></pre>
3848

3949
<h2 id="available-options">Available Options <a href="#available-options" class="anchor">#</a></h2>
4050
<table>
4151
<tr><th>Option</th><th>Type</th><th>Default</th><th>Description</th></tr>
42-
<tr><td><code>base_url</code></td><td><code>str</code></td><td><code>https://www.ratemyprofessors.com/graphql</code></td><td>GraphQL endpoint URL</td></tr>
52+
<tr><td><code>base_url</code></td><td><code>str</code></td><td><code>https://...graphql</code></td><td>GraphQL endpoint URL</td></tr>
4353
<tr><td><code>timeout_seconds</code></td><td><code>float</code></td><td><code>10.0</code></td><td>HTTP request timeout</td></tr>
4454
<tr><td><code>max_retries</code></td><td><code>int</code></td><td><code>3</code></td><td>Number of retry attempts for failed requests</td></tr>
4555
<tr><td><code>rate_limit_per_minute</code></td><td><code>int</code></td><td><code>60</code></td><td>Max requests per minute (token bucket)</td></tr>
46-
<tr><td><code>user_agent</code></td><td><code>str</code></td><td>Firefox UA</td><td>User-Agent header sent with every request</td></tr>
56+
<tr><td><code>user_agent</code></td><td><code>str</code></td><td>Firefox UA</td><td>User-Agent header</td></tr>
4757
<tr><td><code>default_headers</code></td><td><code>Mapping[str, str]</code></td><td>UA + Accept-Language</td><td>Default headers for all requests</td></tr>
4858
</table>
4959

5060
<h2 id="rate-limiting">Rate Limiting <a href="#rate-limiting" class="anchor">#</a></h2>
51-
<p>
52-
The client uses a token-bucket algorithm. Tokens replenish continuously at
53-
<code>rate_limit_per_minute / 60</code> tokens per second. Each request consumes one token.
54-
If no tokens are available, the request blocks until one becomes available.
55-
</p>
56-
<pre><code>config = RMPClientConfig(rate_limit_per_minute=30) # half the default rate</code></pre>
61+
<p>The client uses a token-bucket algorithm. Tokens replenish continuously. Each request consumes one token. If no tokens are available, the request blocks until one becomes available.</p>
62+
<pre><code class="language-python">config = RMPClientConfig(rate_limit_per_minute=30)</code></pre>
5763

5864
<h2 id="retries">Retries <a href="#retries" class="anchor">#</a></h2>
59-
<p>
60-
On 5xx errors or network failures, the client retries up to <code>max_retries</code> times.
61-
4xx errors are <strong>not</strong> retried. After exhausting retries, a <code>RetryError</code>
62-
is raised containing the last underlying exception.
63-
</p>
64-
<pre><code>config = RMPClientConfig(max_retries=5) # more retries for flaky networks</code></pre>
65+
<p>On 5xx errors or network failures, the client retries up to <code>max_retries</code> times. 4xx errors are <strong>not</strong> retried. After exhausting retries, a <code>RetryError</code> is raised.</p>
66+
<pre><code class="language-python">config = RMPClientConfig(max_retries=5)</code></pre>
6567

6668
<h2 id="timeouts">Timeouts <a href="#timeouts" class="anchor">#</a></h2>
6769
<p>The <code>timeout_seconds</code> value applies to each individual HTTP request (connect + read).</p>
68-
<pre><code>config = RMPClientConfig(timeout_seconds=30.0) # generous timeout</code></pre>
70+
<pre><code class="language-python">config = RMPClientConfig(timeout_seconds=30.0)</code></pre>
6971
</main>
72+
73+
<aside class="toc"><div class="toc-title">On this page</div><ul id="toc-list"></ul></aside>
74+
<script src="script.js"></script>
7075
</body>
7176
</html>

docs/extras.html

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,57 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Extras &mdash; RMP Client</title>
77
<link rel="stylesheet" href="style.css" />
8+
<link id="hljs-theme" rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/styles/github-dark.min.css" />
9+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/highlight.min.js"></script>
10+
<script>
11+
(function(){var t=localStorage.getItem('rmp-docs-theme');var d=t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme:dark)').matches);if(d)document.documentElement.classList.add('dark')})();
12+
</script>
813
</head>
914
<body>
15+
<header class="topbar">
16+
<div class="topbar-right">
17+
<a href="https://github.com/amaanjaved1/Rate-My-Professors-API-Client" class="topbar-btn" target="_blank" rel="noopener" aria-label="GitHub">
18+
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/></svg>
19+
</a>
20+
<button class="topbar-btn" id="theme-toggle" aria-label="Toggle theme"></button>
21+
</div>
22+
</header>
23+
1024
<aside class="sidebar">
11-
<div class="sidebar-brand"><span class="dot"></span>RMP Client</div>
12-
<nav>
13-
<ul>
14-
<li><a href="index.html">Home</a></li>
15-
<li><a href="usage.html">Usage</a></li>
16-
<li><a href="reference.html">API Reference</a></li>
17-
<li><a href="configuration.html">Configuration</a></li>
18-
<li><a href="extras.html" class="active">Extras</a></li>
19-
</ul>
20-
</nav>
25+
<div class="sidebar-brand">RMP API Docs</div>
26+
<nav><ul>
27+
<li><a href="index.html">Home</a></li>
28+
<li><a href="usage.html">Usage</a></li>
29+
<li><a href="reference.html">API Reference</a></li>
30+
<li><a href="configuration.html">Configuration</a></li>
31+
<li><a href="extras.html" class="active">Extras</a></li>
32+
</ul></nav>
2133
</aside>
2234

2335
<main class="content">
2436
<h1>Extras</h1>
2537
<p>Helpers for ingestion pipelines. Import them from <code>rmp_client</code>:</p>
26-
<pre><code>from rmp_client import (
27-
analyze_sentiment,
28-
normalize_comment,
29-
is_valid_comment,
30-
build_course_mapping,
38+
<pre><code class="language-python">from rmp_client import (
39+
analyze_sentiment, normalize_comment,
40+
is_valid_comment, build_course_mapping,
3141
clean_course_label,
3242
)</code></pre>
3343

3444
<h2 id="sentiment">Sentiment <a href="#sentiment" class="anchor">#</a></h2>
3545
<p>Compute a sentiment score and label from comment text (uses TextBlob internally).</p>
36-
<pre><code>result = analyze_sentiment("Great prof, explains concepts clearly.")
46+
<pre><code class="language-python">result = analyze_sentiment("Great prof, explains concepts clearly.")
3747
print(result.score, result.label) # e.g. 0.65 "positive"</code></pre>
3848

3949
<h2 id="dedupe-helpers">Dedupe Helpers <a href="#dedupe-helpers" class="anchor">#</a></h2>
4050
<p>Normalize comments for deduplication and filter out low-quality entries.</p>
41-
<pre><code>raw = " This prof is AMAZING!!! "
51+
<pre><code class="language-python">raw = " This prof is AMAZING!!! "
4252
normalized = normalize_comment(raw) # "this prof is amazing!!!"
4353
if is_valid_comment(normalized, min_len=10):
4454
print("Valid comment")</code></pre>
4555

4656
<h2 id="course-code-helpers">Course Code Helpers <a href="#course-code-helpers" class="anchor">#</a></h2>
4757
<p>Map scraped RMP course labels to your course catalog.</p>
48-
<pre><code>scraped = ["ANAT 215 (12)", "phys115"]
58+
<pre><code class="language-python">scraped = ["ANAT 215 (12)", "phys115"]
4959
valid = ["ANAT 215", "PHYS 115"]
5060

5161
mapping = build_course_mapping(scraped, valid)
@@ -54,5 +64,8 @@ <h2 id="course-code-helpers">Course Code Helpers <a href="#course-code-helpers"
5464
cleaned = clean_course_label("MATH 101 (5)")
5565
# "MATH 101"</code></pre>
5666
</main>
67+
68+
<aside class="toc"><div class="toc-title">On this page</div><ul id="toc-list"></ul></aside>
69+
<script src="script.js"></script>
5770
</body>
5871
</html>

docs/index.html

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,54 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>RateMyProfessors API Client (Python)</title>
77
<link rel="stylesheet" href="style.css" />
8+
<link id="hljs-theme" rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/styles/github-dark.min.css" />
9+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11/build/highlight.min.js"></script>
10+
<script>
11+
(function(){var t=localStorage.getItem('rmp-docs-theme');var d=t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme:dark)').matches);if(d)document.documentElement.classList.add('dark')})();
12+
</script>
813
</head>
914
<body>
15+
<header class="topbar">
16+
<div class="topbar-right">
17+
<a href="https://github.com/amaanjaved1/Rate-My-Professors-API-Client" class="topbar-btn" target="_blank" rel="noopener" aria-label="GitHub">
18+
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/></svg>
19+
</a>
20+
<button class="topbar-btn" id="theme-toggle" aria-label="Toggle theme"></button>
21+
</div>
22+
</header>
23+
1024
<aside class="sidebar">
11-
<div class="sidebar-brand"><span class="dot"></span>RMP Client</div>
12-
<nav>
13-
<ul>
14-
<li><a href="index.html" class="active">Home</a></li>
15-
<li><a href="usage.html">Usage</a></li>
16-
<li><a href="reference.html">API Reference</a></li>
17-
<li><a href="configuration.html">Configuration</a></li>
18-
<li><a href="extras.html">Extras</a></li>
19-
</ul>
20-
</nav>
25+
<div class="sidebar-brand">RMP API Docs</div>
26+
<nav><ul>
27+
<li><a href="index.html" class="active">Home</a></li>
28+
<li><a href="usage.html">Usage</a></li>
29+
<li><a href="reference.html">API Reference</a></li>
30+
<li><a href="configuration.html">Configuration</a></li>
31+
<li><a href="extras.html">Extras</a></li>
32+
</ul></nav>
2133
</aside>
2234

2335
<main class="content">
2436
<h1>RateMyProfessors API Client</h1>
25-
<p style="display:flex;gap:6px;flex-wrap:wrap;margin-bottom:1.25rem">
37+
<div class="badges">
2638
<a href="https://pypi.org/project/ratemyprofessors-client/"><img src="https://img.shields.io/pypi/v/ratemyprofessors-client?color=10b981" alt="PyPI" /></a>
2739
<a href="https://pypi.org/project/ratemyprofessors-client/"><img src="https://img.shields.io/pepy/dt/ratemyprofessors-client" alt="downloads" /></a>
28-
<a href="https://amaanjaved1.github.io/Rate-My-Professors-API-Client/"><img src="https://img.shields.io/badge/docs-website-10b981" alt="docs" /></a>
29-
</p>
40+
</div>
3041
<p>
3142
An unofficial, typed Python client for <a href="https://www.ratemyprofessors.com">RateMyProfessors</a>.
3243
All data is fetched via RMP's GraphQL API &mdash; no HTML scraping or browser automation required.
3344
</p>
3445

3546
<div class="callout">
36-
<strong>Disclaimer:</strong> This library is unofficial and may break if RMP changes their
37-
internal API. Use responsibly and respect rate limits.
47+
<strong>Disclaimer:</strong> This library is unofficial and may break if RMP changes their internal API. Use responsibly and respect rate limits.
3848
</div>
3949

4050
<h2 id="features">Features <a href="#features" class="anchor">#</a></h2>
4151
<ul>
4252
<li>Strong typing via Pydantic models</li>
4353
<li>Automatic retries with configurable max attempts</li>
4454
<li>Token-bucket rate limiting (default 60 req/min)</li>
45-
<li>In-memory caching for ratings pages (pre-fetches all ratings on first load)</li>
55+
<li>In-memory caching for ratings pages</li>
4656
<li>Cursor-based pagination for all list/search endpoints</li>
4757
<li>Clear error hierarchy for precise exception handling</li>
4858
<li>Built-in helpers for ingestion workflows (sentiment, dedupe, course codes)</li>
@@ -55,10 +65,10 @@ <h2 id="requirements">Requirements <a href="#requirements" class="anchor">#</a><
5565
</ul>
5666

5767
<h2 id="installation">Installation <a href="#installation" class="anchor">#</a></h2>
58-
<pre><code>pip install ratemyprofessors-client</code></pre>
68+
<pre><code class="language-bash">pip install ratemyprofessors-client</code></pre>
5969

6070
<h2 id="quick-start">Quick Start <a href="#quick-start" class="anchor">#</a></h2>
61-
<pre><code>from rmp_client import RMPClient
71+
<pre><code class="language-python">from rmp_client import RMPClient
6272

6373
with RMPClient() as client:
6474
prof = client.get_professor("2823076")
@@ -75,5 +85,8 @@ <h2 id="documentation">Documentation <a href="#documentation" class="anchor">#</
7585
<li><a href="extras.html">Extras</a> &mdash; Ingestion helpers (sentiment, dedupe, course mapping)</li>
7686
</ul>
7787
</main>
88+
89+
<aside class="toc"><div class="toc-title">On this page</div><ul id="toc-list"></ul></aside>
90+
<script src="script.js"></script>
7891
</body>
7992
</html>

0 commit comments

Comments
 (0)