perplexity-webui-scraper 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: perplexity-webui-scraper
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Python scraper to extract AI responses from Perplexity's web interface.
5
5
  Keywords: perplexity,ai,scraper,webui,api,client
6
6
  Author: henrique-coder
@@ -20,14 +20,18 @@ Classifier: Topic :: Internet :: WWW/HTTP
20
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
21
  Classifier: Typing :: Typed
22
22
  Requires-Dist: curl-cffi>=0.14.0
23
+ Requires-Dist: loguru>=0.7.3
23
24
  Requires-Dist: orjson>=3.11.5
24
25
  Requires-Dist: pydantic>=2.12.5
25
- Requires-Python: >=3.10
26
+ Requires-Dist: tenacity>=9.1.2
27
+ Requires-Dist: fastmcp>=2.14.1 ; extra == 'mcp'
28
+ Requires-Python: >=3.10, <3.15
26
29
  Project-URL: Changelog, https://github.com/henrique-coder/perplexity-webui-scraper/releases
27
30
  Project-URL: Documentation, https://github.com/henrique-coder/perplexity-webui-scraper#readme
28
31
  Project-URL: Homepage, https://github.com/henrique-coder/perplexity-webui-scraper
29
32
  Project-URL: Issues, https://github.com/henrique-coder/perplexity-webui-scraper/issues
30
33
  Project-URL: Repository, https://github.com/henrique-coder/perplexity-webui-scraper.git
34
+ Provides-Extra: mcp
31
35
  Description-Content-Type: text/markdown
32
36
 
33
37
  <div align="center">
@@ -47,7 +51,8 @@ Python scraper to extract AI responses from [Perplexity's](https://www.perplexit
47
51
  ## Installation
48
52
 
49
53
  ```bash
50
- uv pip install perplexity-webui-scraper
54
+ uv pip install perplexity-webui-scraper # from PyPI (stable)
55
+ uv pip install git+https://github.com/henrique-coder/perplexity-webui-scraper.git@dev # from GitHub (development)
51
56
  ```
52
57
 
53
58
  ## Requirements
@@ -197,18 +202,103 @@ conversation.ask("Latest AI research", files=["paper.pdf"])
197
202
  | `timezone` | `None` | Timezone |
198
203
  | `coordinates` | `None` | Location (lat/lng) |
199
204
 
200
- ## CLI Tools
205
+ ## Exceptions
201
206
 
202
- ### Session Token Generator
207
+ The library provides specific exception types for better error handling:
208
+
209
+ | Exception | Description |
210
+ | ---------------------------------- | ------------------------------------------------------------ |
211
+ | `PerplexityError` | Base exception for all library errors |
212
+ | `AuthenticationError` | Session token is invalid or expired (HTTP 403) |
213
+ | `RateLimitError` | Rate limit exceeded (HTTP 429) |
214
+ | `FileUploadError` | File upload failed |
215
+ | `FileValidationError` | File validation failed (size, type, etc.) |
216
+ | `ResearchClarifyingQuestionsError` | Research mode is asking clarifying questions (not supported) |
217
+ | `ResponseParsingError` | API response could not be parsed |
218
+ | `StreamingError` | Error during streaming response |
219
+
220
+ ### Handling Research Mode Clarifying Questions
221
+
222
+ When using Research mode (`Models.RESEARCH`), the API may ask clarifying questions before providing an answer. Since programmatic interaction is not supported, the library raises a `ResearchClarifyingQuestionsError` with the questions:
223
+
224
+ ```python
225
+ from perplexity_webui_scraper import (
226
+ Perplexity,
227
+ ResearchClarifyingQuestionsError,
228
+ )
229
+
230
+ try:
231
+ conversation.ask("Research this topic", model=Models.RESEARCH)
232
+ except ResearchClarifyingQuestionsError as error:
233
+ print("The AI needs clarification:")
234
+ for question in error.questions:
235
+ print(f" - {question}")
236
+ # Consider rephrasing your query to be more specific
237
+ ```
238
+
239
+ ## MCP Server (Model Context Protocol)
240
+
241
+ The library includes an MCP server that allows AI assistants (like Claude) to search using Perplexity AI directly.
242
+
243
+ ### Installation
203
244
 
204
245
  ```bash
205
- get-perplexity-session-token
246
+ uv pip install perplexity-webui-scraper[mcp]
247
+ ```
248
+
249
+ ### Running the Server
250
+
251
+ ```bash
252
+ # Set your session token
253
+ export PERPLEXITY_SESSION_TOKEN="your_token_here" # For Linux/Mac
254
+ set PERPLEXITY_SESSION_TOKEN="your_token_here" # For Windows
255
+
256
+ # Run with FastMCP
257
+ uv run fastmcp run src/perplexity_webui_scraper/mcp/server.py
258
+
259
+ # Or test with the dev inspector
260
+ uv run fastmcp dev src/perplexity_webui_scraper/mcp/server.py
261
+ ```
262
+
263
+ ### Claude Desktop Configuration
264
+
265
+ Add to `~/.config/claude/claude_desktop_config.json`:
266
+
267
+ ```json
268
+ {
269
+ "mcpServers": {
270
+ "perplexity": {
271
+ "command": "uv",
272
+ "args": [
273
+ "run",
274
+ "fastmcp",
275
+ "run",
276
+ "path/to/perplexity_webui_scraper/mcp/server.py"
277
+ ],
278
+ "env": {
279
+ "PERPLEXITY_SESSION_TOKEN": "your_token_here"
280
+ }
281
+ }
282
+ }
283
+ }
206
284
  ```
207
285
 
208
- Interactive tool to automatically obtain your Perplexity session token via email authentication. The token can be automatically saved to your `.env` file for immediate use.
286
+ ### Available Tool
287
+
288
+ | Tool | Description |
289
+ | ---------------- | --------------------------------------------------------------------------- |
290
+ | `perplexity_ask` | Ask questions and get AI-generated answers with real-time data from the web |
291
+
292
+ **Parameters:**
293
+
294
+ | Parameter | Type | Default | Description |
295
+ | -------------- | ----- | -------- | ------------------------------------------------------------- |
296
+ | `query` | `str` | - | Question to ask (required) |
297
+ | `model` | `str` | `"best"` | AI model (`best`, `research`, `gpt52`, `claude_sonnet`, etc.) |
298
+ | `source_focus` | `str` | `"web"` | Source type (`web`, `academic`, `social`, `finance`, `all`) |
209
299
 
210
300
  ## Disclaimer
211
301
 
212
- This is an **unofficial** library. It uses internal APIs that may change without notice. Use at your own risk. Not for production use.
302
+ This is an **unofficial** library. It uses internal APIs that may change without notice. Use at your own risk.
213
303
 
214
304
  By using this library, you agree to Perplexity AI's Terms of Service.
@@ -0,0 +1,21 @@
1
+ perplexity_webui_scraper/__init__.py,sha256=7hLTMTHMC-aCvbDRMXCUBfJ3vztsW9WtEZ08LdIYs9I,713
2
+ perplexity_webui_scraper/cli/get_perplexity_session_token.py,sha256=67Ck4S2MJ0701LnRHq73qY5oRLCsFOyu_8SMgsbTNFc,6937
3
+ perplexity_webui_scraper/config.py,sha256=05lkW9PlMmbj-oh-4xc3-iFXXGvKfKCy8yK-O1GWJdw,2055
4
+ perplexity_webui_scraper/constants.py,sha256=Kq-4i6yyTZ5VhUvbiZmbUmHrjMQm-p7H82Emm7b10-c,1867
5
+ perplexity_webui_scraper/core.py,sha256=dpcx8tTxESWz_iz7nSKN1XWRvBOV_cD9gK-E2gJYJ8w,20894
6
+ perplexity_webui_scraper/enums.py,sha256=I-jMiQMzBW72PGJFBNZIc874wijBMynDF-pYQmS1OZc,2751
7
+ perplexity_webui_scraper/exceptions.py,sha256=Q2dx7j1OrM9CB7ty8fRhheAt4-QhN7szUDXzoT6rx1E,3985
8
+ perplexity_webui_scraper/http.py,sha256=1qxZ3cvkL-TXST2H1V7AUoA5_poZ9sDBm8OV3FEtWZU,19708
9
+ perplexity_webui_scraper/limits.py,sha256=GwcwC8CnSNhlcLWGLpuDYA37gn8OXSfsXLIOc-QbxNs,465
10
+ perplexity_webui_scraper/logging.py,sha256=5IyUiKjN88WCItKl6Yrbfn6rF6jz68rWjFTWQGdvTRo,7129
11
+ perplexity_webui_scraper/mcp/__init__.py,sha256=Ke166qPFVZORf39lc6cHjKoBbbuJztAfU29vYpCwOrA,366
12
+ perplexity_webui_scraper/mcp/__main__.py,sha256=N_cSeNjAzSJ861jspq60W0ZVjxWNXhM5O-FQ0aD1oPs,146
13
+ perplexity_webui_scraper/mcp/server.py,sha256=dadzelHJO3Fkw85hdUiTO10jFaZB26D5e5jWuL3yVoA,5982
14
+ perplexity_webui_scraper/models.py,sha256=QVeZI-WQzpyi9JnE15QIMJ7nsG0YjIjOsZEA6YfX0tw,2448
15
+ perplexity_webui_scraper/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ perplexity_webui_scraper/resilience.py,sha256=-_XYYCazsx5jxrc2HbuJBP16TLh02EEhy8WOukLmbFE,4662
17
+ perplexity_webui_scraper/types.py,sha256=VlnzvNilIHrDXM2YOGjJa1y2VY0tfR-F0zaPjQHoPKs,1028
18
+ perplexity_webui_scraper-0.3.5.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
19
+ perplexity_webui_scraper-0.3.5.dist-info/entry_points.txt,sha256=ODpXpDTkmoQ_o3Y3lsy22PLs-8ndapvMKYwxcz6A9gs,189
20
+ perplexity_webui_scraper-0.3.5.dist-info/METADATA,sha256=NEkzx5B0HIj9gA9p72e6v0GOTG6cHoEWeSatgaoghhw,12175
21
+ perplexity_webui_scraper-0.3.5.dist-info/RECORD,,
@@ -1,3 +1,4 @@
1
1
  [console_scripts]
2
2
  get-perplexity-session-token = perplexity_webui_scraper.cli.get_perplexity_session_token:get_token
3
+ perplexity-webui-scraper-mcp = perplexity_webui_scraper.mcp:run_server
3
4
 
@@ -1,16 +0,0 @@
1
- perplexity_webui_scraper/__init__.py,sha256=aUs8lsx11WeqDi-ZT4Y2RiEhQVd6K66EZZ6x0BDuU90,949
2
- perplexity_webui_scraper/cli/get_perplexity_session_token.py,sha256=67Ck4S2MJ0701LnRHq73qY5oRLCsFOyu_8SMgsbTNFc,6937
3
- perplexity_webui_scraper/config.py,sha256=tjTwTFO39ONI4yOodqAov6sAXti18DiOOwFndpct68o,944
4
- perplexity_webui_scraper/constants.py,sha256=Kq-4i6yyTZ5VhUvbiZmbUmHrjMQm-p7H82Emm7b10-c,1867
5
- perplexity_webui_scraper/core.py,sha256=QGDjdd_h8fV7yE4ukV6iL8xuidxlxDzu5HvUx0W-0tA,14824
6
- perplexity_webui_scraper/enums.py,sha256=Xo7RmtWFxhSQU2Zma5sFmMyitOqlqjAb4XwRC0KJON0,2124
7
- perplexity_webui_scraper/exceptions.py,sha256=0oOWe_A0B0wBsFeogt323BGJY3oBzaFK9PItXs77J70,1629
8
- perplexity_webui_scraper/http.py,sha256=4x0LSCpKFtIR_izFYaGWXvNcewnXGnICFoPJNP892W8,5615
9
- perplexity_webui_scraper/limits.py,sha256=GwcwC8CnSNhlcLWGLpuDYA37gn8OXSfsXLIOc-QbxNs,465
10
- perplexity_webui_scraper/models.py,sha256=QVeZI-WQzpyi9JnE15QIMJ7nsG0YjIjOsZEA6YfX0tw,2448
11
- perplexity_webui_scraper/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- perplexity_webui_scraper/types.py,sha256=VlnzvNilIHrDXM2YOGjJa1y2VY0tfR-F0zaPjQHoPKs,1028
13
- perplexity_webui_scraper-0.3.4.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
14
- perplexity_webui_scraper-0.3.4.dist-info/entry_points.txt,sha256=x98Wqg3iD6aXxtm27KmB-BXPFo1ccDDGRaCp6fWn9m4,118
15
- perplexity_webui_scraper-0.3.4.dist-info/METADATA,sha256=Mm1LlknQT4ipS2bT-mtrcnNvCSjgjrW79tyQU0mxu9s,8557
16
- perplexity_webui_scraper-0.3.4.dist-info/RECORD,,