perplexity-webui-scraper 0.3.2__tar.gz → 0.3.4__tar.gz

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.
Files changed (19) hide show
  1. perplexity_webui_scraper-0.3.4/PKG-INFO +214 -0
  2. perplexity_webui_scraper-0.3.4/README.md +182 -0
  3. perplexity_webui_scraper-0.3.4/pyproject.toml +109 -0
  4. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/__init__.py +14 -21
  5. perplexity_webui_scraper-0.3.4/src/perplexity_webui_scraper/cli/get_perplexity_session_token.py +216 -0
  6. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/config.py +2 -2
  7. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/constants.py +9 -35
  8. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/core.py +89 -27
  9. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/http.py +11 -4
  10. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/limits.py +2 -5
  11. perplexity_webui_scraper-0.3.4/src/perplexity_webui_scraper/models.py +73 -0
  12. perplexity_webui_scraper-0.3.2/PKG-INFO +0 -146
  13. perplexity_webui_scraper-0.3.2/README.md +0 -134
  14. perplexity_webui_scraper-0.3.2/pyproject.toml +0 -27
  15. perplexity_webui_scraper-0.3.2/src/perplexity_webui_scraper/models.py +0 -58
  16. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/enums.py +0 -0
  17. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/exceptions.py +0 -0
  18. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/py.typed +0 -0
  19. {perplexity_webui_scraper-0.3.2 → perplexity_webui_scraper-0.3.4}/src/perplexity_webui_scraper/types.py +0 -0
@@ -0,0 +1,214 @@
1
+ Metadata-Version: 2.4
2
+ Name: perplexity-webui-scraper
3
+ Version: 0.3.4
4
+ Summary: Python scraper to extract AI responses from Perplexity's web interface.
5
+ Keywords: perplexity,ai,scraper,webui,api,client
6
+ Author: henrique-coder
7
+ Author-email: henrique-coder <henriquemoreira10fk@gmail.com>
8
+ License-Expression: MIT
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: curl-cffi>=0.14.0
23
+ Requires-Dist: orjson>=3.11.5
24
+ Requires-Dist: pydantic>=2.12.5
25
+ Requires-Python: >=3.10
26
+ Project-URL: Changelog, https://github.com/henrique-coder/perplexity-webui-scraper/releases
27
+ Project-URL: Documentation, https://github.com/henrique-coder/perplexity-webui-scraper#readme
28
+ Project-URL: Homepage, https://github.com/henrique-coder/perplexity-webui-scraper
29
+ Project-URL: Issues, https://github.com/henrique-coder/perplexity-webui-scraper/issues
30
+ Project-URL: Repository, https://github.com/henrique-coder/perplexity-webui-scraper.git
31
+ Description-Content-Type: text/markdown
32
+
33
+ <div align="center">
34
+
35
+ # Perplexity WebUI Scraper
36
+
37
+ Python scraper to extract AI responses from [Perplexity's](https://www.perplexity.ai) web interface.
38
+
39
+ [![PyPI](https://img.shields.io/pypi/v/perplexity-webui-scraper?color=blue)](https://pypi.org/project/perplexity-webui-scraper)
40
+ [![Python](https://img.shields.io/pypi/pyversions/perplexity-webui-scraper)](https://pypi.org/project/perplexity-webui-scraper)
41
+ [![License](https://img.shields.io/github/license/henrique-coder/perplexity-webui-scraper?color=green)](./LICENSE)
42
+
43
+ </div>
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ uv pip install perplexity-webui-scraper
51
+ ```
52
+
53
+ ## Requirements
54
+
55
+ - **Perplexity Pro/Max account**
56
+ - **Session token** (`__Secure-next-auth.session-token` cookie from your browser)
57
+
58
+ ### Getting Your Session Token
59
+
60
+ You can obtain your session token in two ways:
61
+
62
+ #### Option 1: Automatic (CLI Tool)
63
+
64
+ The package includes a CLI tool to automatically generate and save your session token:
65
+
66
+ ```bash
67
+ get-perplexity-session-token
68
+ ```
69
+
70
+ This interactive tool will:
71
+
72
+ 1. Ask for your Perplexity email
73
+ 2. Send a verification code to your email
74
+ 3. Accept either a 6-digit code or magic link
75
+ 4. Extract and display your session token
76
+ 5. Optionally save it to your `.env` file
77
+
78
+ **Features:**
79
+
80
+ - Secure ephemeral session (cleared on exit)
81
+ - Automatic `.env` file management
82
+ - Support for both OTP codes and magic links
83
+ - Clean terminal interface with status updates
84
+
85
+ #### Option 2: Manual (Browser)
86
+
87
+ If you prefer to extract the token manually:
88
+
89
+ 1. Log in at [perplexity.ai](https://www.perplexity.ai)
90
+ 2. Open DevTools (`F12`) → Application/Storage → Cookies
91
+ 3. Copy the value of `__Secure-next-auth.session-token`
92
+ 4. Store in `.env`: `PERPLEXITY_SESSION_TOKEN="your_token"`
93
+
94
+ ## Quick Start
95
+
96
+ ```python
97
+ from perplexity_webui_scraper import Perplexity
98
+
99
+ client = Perplexity(session_token="YOUR_TOKEN")
100
+ conversation = client.create_conversation()
101
+
102
+ conversation.ask("What is quantum computing?")
103
+ print(conversation.answer)
104
+
105
+ # Follow-up
106
+ conversation.ask("Explain it simpler")
107
+ print(conversation.answer)
108
+ ```
109
+
110
+ ### Streaming
111
+
112
+ ```python
113
+ for chunk in conversation.ask("Explain AI", stream=True):
114
+ print(chunk.answer)
115
+ ```
116
+
117
+ ### With Options
118
+
119
+ ```python
120
+ from perplexity_webui_scraper import (
121
+ ConversationConfig,
122
+ Coordinates,
123
+ Models,
124
+ SourceFocus,
125
+ )
126
+
127
+ config = ConversationConfig(
128
+ model=Models.RESEARCH,
129
+ source_focus=[SourceFocus.WEB, SourceFocus.ACADEMIC],
130
+ language="en-US",
131
+ coordinates=Coordinates(latitude=40.7128, longitude=-74.0060),
132
+ )
133
+
134
+ conversation = client.create_conversation(config)
135
+ conversation.ask("Latest AI research", files=["paper.pdf"])
136
+ ```
137
+
138
+ ## API
139
+
140
+ ### `Perplexity(session_token, config?)`
141
+
142
+ | Parameter | Type | Description |
143
+ | --------------- | -------------- | ------------------ |
144
+ | `session_token` | `str` | Browser cookie |
145
+ | `config` | `ClientConfig` | Timeout, TLS, etc. |
146
+
147
+ ### `Conversation.ask(query, model?, files?, citation_mode?, stream?)`
148
+
149
+ | Parameter | Type | Default | Description |
150
+ | --------------- | ----------------------- | ------------- | ------------------- |
151
+ | `query` | `str` | - | Question (required) |
152
+ | `model` | `Model` | `Models.BEST` | AI model |
153
+ | `files` | `list[str \| PathLike]` | `None` | File paths |
154
+ | `citation_mode` | `CitationMode` | `CLEAN` | Citation format |
155
+ | `stream` | `bool` | `False` | Enable streaming |
156
+
157
+ ### Models
158
+
159
+ | Model | Description |
160
+ | ---------------------------------- | ------------------------------------------------------------------------- |
161
+ | `Models.RESEARCH` | Research - Fast and thorough for routine research |
162
+ | `Models.LABS` | Labs - Multi-step tasks with advanced troubleshooting |
163
+ | `Models.BEST` | Best - Automatically selects the most responsive model based on the query |
164
+ | `Models.SONAR` | Sonar - Perplexity's fast model |
165
+ | `Models.GPT_52` | GPT-5.2 - OpenAI's latest model |
166
+ | `Models.GPT_52_THINKING` | GPT-5.2 Thinking - OpenAI's latest model with thinking |
167
+ | `Models.CLAUDE_45_OPUS` | Claude Opus 4.5 - Anthropic's Opus reasoning model |
168
+ | `Models.CLAUDE_45_OPUS_THINKING` | Claude Opus 4.5 Thinking - Anthropic's Opus reasoning model with thinking |
169
+ | `Models.GEMINI_3_PRO` | Gemini 3 Pro - Google's newest reasoning model |
170
+ | `Models.GEMINI_3_FLASH` | Gemini 3 Flash - Google's fast reasoning model |
171
+ | `Models.GEMINI_3_FLASH_THINKING` | Gemini 3 Flash Thinking - Google's fast reasoning model with thinking |
172
+ | `Models.GROK_41` | Grok 4.1 - xAI's latest advanced model |
173
+ | `Models.GROK_41_THINKING` | Grok 4.1 Thinking - xAI's latest reasoning model |
174
+ | `Models.KIMI_K2_THINKING` | Kimi K2 Thinking - Moonshot AI's latest reasoning model |
175
+ | `Models.CLAUDE_45_SONNET` | Claude Sonnet 4.5 - Anthropic's newest advanced model |
176
+ | `Models.CLAUDE_45_SONNET_THINKING` | Claude Sonnet 4.5 Thinking - Anthropic's newest reasoning model |
177
+
178
+ ### CitationMode
179
+
180
+ | Mode | Output |
181
+ | ---------- | --------------------- |
182
+ | `DEFAULT` | `text[1]` |
183
+ | `MARKDOWN` | `text[1](url)` |
184
+ | `CLEAN` | `text` (no citations) |
185
+
186
+ ### ConversationConfig
187
+
188
+ | Parameter | Default | Description |
189
+ | ----------------- | ------------- | ------------------ |
190
+ | `model` | `Models.BEST` | Default model |
191
+ | `citation_mode` | `CLEAN` | Citation format |
192
+ | `save_to_library` | `False` | Save to library |
193
+ | `search_focus` | `WEB` | Search type |
194
+ | `source_focus` | `WEB` | Source types |
195
+ | `time_range` | `ALL` | Time filter |
196
+ | `language` | `"en-US"` | Response language |
197
+ | `timezone` | `None` | Timezone |
198
+ | `coordinates` | `None` | Location (lat/lng) |
199
+
200
+ ## CLI Tools
201
+
202
+ ### Session Token Generator
203
+
204
+ ```bash
205
+ get-perplexity-session-token
206
+ ```
207
+
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.
209
+
210
+ ## Disclaimer
211
+
212
+ This is an **unofficial** library. It uses internal APIs that may change without notice. Use at your own risk. Not for production use.
213
+
214
+ By using this library, you agree to Perplexity AI's Terms of Service.
@@ -0,0 +1,182 @@
1
+ <div align="center">
2
+
3
+ # Perplexity WebUI Scraper
4
+
5
+ Python scraper to extract AI responses from [Perplexity's](https://www.perplexity.ai) web interface.
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/perplexity-webui-scraper?color=blue)](https://pypi.org/project/perplexity-webui-scraper)
8
+ [![Python](https://img.shields.io/pypi/pyversions/perplexity-webui-scraper)](https://pypi.org/project/perplexity-webui-scraper)
9
+ [![License](https://img.shields.io/github/license/henrique-coder/perplexity-webui-scraper?color=green)](./LICENSE)
10
+
11
+ </div>
12
+
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ uv pip install perplexity-webui-scraper
19
+ ```
20
+
21
+ ## Requirements
22
+
23
+ - **Perplexity Pro/Max account**
24
+ - **Session token** (`__Secure-next-auth.session-token` cookie from your browser)
25
+
26
+ ### Getting Your Session Token
27
+
28
+ You can obtain your session token in two ways:
29
+
30
+ #### Option 1: Automatic (CLI Tool)
31
+
32
+ The package includes a CLI tool to automatically generate and save your session token:
33
+
34
+ ```bash
35
+ get-perplexity-session-token
36
+ ```
37
+
38
+ This interactive tool will:
39
+
40
+ 1. Ask for your Perplexity email
41
+ 2. Send a verification code to your email
42
+ 3. Accept either a 6-digit code or magic link
43
+ 4. Extract and display your session token
44
+ 5. Optionally save it to your `.env` file
45
+
46
+ **Features:**
47
+
48
+ - Secure ephemeral session (cleared on exit)
49
+ - Automatic `.env` file management
50
+ - Support for both OTP codes and magic links
51
+ - Clean terminal interface with status updates
52
+
53
+ #### Option 2: Manual (Browser)
54
+
55
+ If you prefer to extract the token manually:
56
+
57
+ 1. Log in at [perplexity.ai](https://www.perplexity.ai)
58
+ 2. Open DevTools (`F12`) → Application/Storage → Cookies
59
+ 3. Copy the value of `__Secure-next-auth.session-token`
60
+ 4. Store in `.env`: `PERPLEXITY_SESSION_TOKEN="your_token"`
61
+
62
+ ## Quick Start
63
+
64
+ ```python
65
+ from perplexity_webui_scraper import Perplexity
66
+
67
+ client = Perplexity(session_token="YOUR_TOKEN")
68
+ conversation = client.create_conversation()
69
+
70
+ conversation.ask("What is quantum computing?")
71
+ print(conversation.answer)
72
+
73
+ # Follow-up
74
+ conversation.ask("Explain it simpler")
75
+ print(conversation.answer)
76
+ ```
77
+
78
+ ### Streaming
79
+
80
+ ```python
81
+ for chunk in conversation.ask("Explain AI", stream=True):
82
+ print(chunk.answer)
83
+ ```
84
+
85
+ ### With Options
86
+
87
+ ```python
88
+ from perplexity_webui_scraper import (
89
+ ConversationConfig,
90
+ Coordinates,
91
+ Models,
92
+ SourceFocus,
93
+ )
94
+
95
+ config = ConversationConfig(
96
+ model=Models.RESEARCH,
97
+ source_focus=[SourceFocus.WEB, SourceFocus.ACADEMIC],
98
+ language="en-US",
99
+ coordinates=Coordinates(latitude=40.7128, longitude=-74.0060),
100
+ )
101
+
102
+ conversation = client.create_conversation(config)
103
+ conversation.ask("Latest AI research", files=["paper.pdf"])
104
+ ```
105
+
106
+ ## API
107
+
108
+ ### `Perplexity(session_token, config?)`
109
+
110
+ | Parameter | Type | Description |
111
+ | --------------- | -------------- | ------------------ |
112
+ | `session_token` | `str` | Browser cookie |
113
+ | `config` | `ClientConfig` | Timeout, TLS, etc. |
114
+
115
+ ### `Conversation.ask(query, model?, files?, citation_mode?, stream?)`
116
+
117
+ | Parameter | Type | Default | Description |
118
+ | --------------- | ----------------------- | ------------- | ------------------- |
119
+ | `query` | `str` | - | Question (required) |
120
+ | `model` | `Model` | `Models.BEST` | AI model |
121
+ | `files` | `list[str \| PathLike]` | `None` | File paths |
122
+ | `citation_mode` | `CitationMode` | `CLEAN` | Citation format |
123
+ | `stream` | `bool` | `False` | Enable streaming |
124
+
125
+ ### Models
126
+
127
+ | Model | Description |
128
+ | ---------------------------------- | ------------------------------------------------------------------------- |
129
+ | `Models.RESEARCH` | Research - Fast and thorough for routine research |
130
+ | `Models.LABS` | Labs - Multi-step tasks with advanced troubleshooting |
131
+ | `Models.BEST` | Best - Automatically selects the most responsive model based on the query |
132
+ | `Models.SONAR` | Sonar - Perplexity's fast model |
133
+ | `Models.GPT_52` | GPT-5.2 - OpenAI's latest model |
134
+ | `Models.GPT_52_THINKING` | GPT-5.2 Thinking - OpenAI's latest model with thinking |
135
+ | `Models.CLAUDE_45_OPUS` | Claude Opus 4.5 - Anthropic's Opus reasoning model |
136
+ | `Models.CLAUDE_45_OPUS_THINKING` | Claude Opus 4.5 Thinking - Anthropic's Opus reasoning model with thinking |
137
+ | `Models.GEMINI_3_PRO` | Gemini 3 Pro - Google's newest reasoning model |
138
+ | `Models.GEMINI_3_FLASH` | Gemini 3 Flash - Google's fast reasoning model |
139
+ | `Models.GEMINI_3_FLASH_THINKING` | Gemini 3 Flash Thinking - Google's fast reasoning model with thinking |
140
+ | `Models.GROK_41` | Grok 4.1 - xAI's latest advanced model |
141
+ | `Models.GROK_41_THINKING` | Grok 4.1 Thinking - xAI's latest reasoning model |
142
+ | `Models.KIMI_K2_THINKING` | Kimi K2 Thinking - Moonshot AI's latest reasoning model |
143
+ | `Models.CLAUDE_45_SONNET` | Claude Sonnet 4.5 - Anthropic's newest advanced model |
144
+ | `Models.CLAUDE_45_SONNET_THINKING` | Claude Sonnet 4.5 Thinking - Anthropic's newest reasoning model |
145
+
146
+ ### CitationMode
147
+
148
+ | Mode | Output |
149
+ | ---------- | --------------------- |
150
+ | `DEFAULT` | `text[1]` |
151
+ | `MARKDOWN` | `text[1](url)` |
152
+ | `CLEAN` | `text` (no citations) |
153
+
154
+ ### ConversationConfig
155
+
156
+ | Parameter | Default | Description |
157
+ | ----------------- | ------------- | ------------------ |
158
+ | `model` | `Models.BEST` | Default model |
159
+ | `citation_mode` | `CLEAN` | Citation format |
160
+ | `save_to_library` | `False` | Save to library |
161
+ | `search_focus` | `WEB` | Search type |
162
+ | `source_focus` | `WEB` | Source types |
163
+ | `time_range` | `ALL` | Time filter |
164
+ | `language` | `"en-US"` | Response language |
165
+ | `timezone` | `None` | Timezone |
166
+ | `coordinates` | `None` | Location (lat/lng) |
167
+
168
+ ## CLI Tools
169
+
170
+ ### Session Token Generator
171
+
172
+ ```bash
173
+ get-perplexity-session-token
174
+ ```
175
+
176
+ 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.
177
+
178
+ ## Disclaimer
179
+
180
+ This is an **unofficial** library. It uses internal APIs that may change without notice. Use at your own risk. Not for production use.
181
+
182
+ By using this library, you agree to Perplexity AI's Terms of Service.
@@ -0,0 +1,109 @@
1
+ [project]
2
+ name = "perplexity-webui-scraper"
3
+ version = "0.3.4"
4
+ description = "Python scraper to extract AI responses from Perplexity's web interface."
5
+ authors = [{ name = "henrique-coder", email = "henriquemoreira10fk@gmail.com" }]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ requires-python = ">=3.10"
9
+ keywords = ["perplexity", "ai", "scraper", "webui", "api", "client"]
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Developers",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
+ "Topic :: Internet :: WWW/HTTP",
22
+ "Topic :: Software Development :: Libraries :: Python Modules",
23
+ "Typing :: Typed",
24
+ ]
25
+ dependencies = [
26
+ "curl-cffi>=0.14.0",
27
+ "orjson>=3.11.5",
28
+ "pydantic>=2.12.5",
29
+ ]
30
+
31
+ [dependency-groups]
32
+ dev = [
33
+ "beautifulsoup4>=4.14.3",
34
+ "jsbeautifier>=1.15.4",
35
+ "lxml>=6.0.2",
36
+ "python-dotenv>=1.2.1",
37
+ "rich>=14.2.0",
38
+ ]
39
+ lint = [
40
+ "ruff>=0.14.10",
41
+ ]
42
+ tests = [
43
+ "pytest>=9.0.2",
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/henrique-coder/perplexity-webui-scraper"
48
+ Documentation = "https://github.com/henrique-coder/perplexity-webui-scraper#readme"
49
+ Repository = "https://github.com/henrique-coder/perplexity-webui-scraper.git"
50
+ Issues = "https://github.com/henrique-coder/perplexity-webui-scraper/issues"
51
+ Changelog = "https://github.com/henrique-coder/perplexity-webui-scraper/releases"
52
+
53
+ [tool.ruff]
54
+ line-length = 120
55
+ indent-width = 4
56
+
57
+ [tool.ruff.lint]
58
+ select = [
59
+ "F", # Pyflakes: unused imports/variables, undefined names
60
+ "E", # pycodestyle errors: basic PEP 8 style violations
61
+ "W", # pycodestyle warnings: whitespace issues, blank lines
62
+ "I", # isort: import sorting and organization
63
+ "UP", # pyupgrade: upgrade syntax for newer Python versions
64
+ "B", # flake8-bugbear: common bugs and design problems
65
+ "SIM", # flake8-simplify: simplify complex code patterns
66
+ "C4", # flake8-comprehensions: better list/dict/set comprehensions
67
+ "PIE", # flake8-pie: misc. lints (unnecessary pass, duplicate keys)
68
+ "RUF", # Ruff-specific: modern Python best practices
69
+ "PERF", # Perflint: performance anti-patterns
70
+ "FURB", # refurb: modernize legacy Python idioms
71
+ "PTH", # flake8-use-pathlib: prefer pathlib over os.path
72
+ "T20", # flake8-print: detect leftover print() statements
73
+ "TCH", # flake8-type-checking: optimize TYPE_CHECKING imports
74
+ "PL", # Pylint: broad set of code quality checks
75
+ "D205", # 1 blank line required between docstring and code
76
+ ]
77
+ ignore = [
78
+ "PLR0912", # Too many branches (complex validation logic is acceptable)
79
+ "PLR0913", # Too many arguments in function definition (common in APIs)
80
+ "PLR2004", # Magic value used in comparison (too strict for general use)
81
+ ]
82
+ fixable = ["ALL"] # Allow auto-fix for all enabled rules
83
+ dummy-variable-rgx = "^_$" # Only underscore is considered a dummy variable
84
+
85
+ [tool.ruff.lint.isort]
86
+ known-first-party = ["perplexity_webui_scraper"]
87
+ lines-after-imports = 2 # PEP 8: two blank lines after imports
88
+ force-sort-within-sections = true # Alphabetical order within each section
89
+ split-on-trailing-comma = true # Trailing comma triggers multi-line format
90
+
91
+ [tool.ruff.lint.pydocstyle]
92
+ convention = "google" # Google-style docstrings (Args, Returns, Raises)
93
+
94
+ [tool.ruff.lint.flake8-quotes]
95
+ docstring-quotes = "double" # Docstrings must use triple double quotes
96
+
97
+ [tool.ruff.format]
98
+ quote-style = "double" # Strings use double quotes (PEP 8 preference)
99
+ indent-style = "space" # Spaces over tabs (PEP 8)
100
+ line-ending = "lf" # Unix-style line endings
101
+ docstring-code-format = true # Format code examples inside docstrings
102
+ skip-magic-trailing-comma = false # Preserve trailing commas as formatting hints
103
+
104
+ [project.scripts]
105
+ get-perplexity-session-token = "perplexity_webui_scraper.cli.get_perplexity_session_token:get_token"
106
+
107
+ [build-system]
108
+ requires = ["uv_build"]
109
+ build-backend = "uv_build"
@@ -1,6 +1,6 @@
1
- """Unofficial Python client for Perplexity AI."""
1
+ """Extract AI responses from Perplexity's web interface."""
2
2
 
3
- from importlib.metadata import version
3
+ from importlib import metadata
4
4
 
5
5
  from .config import ClientConfig, ConversationConfig
6
6
  from .core import Conversation, Perplexity
@@ -16,31 +16,24 @@ from .models import Model, Models
16
16
  from .types import Coordinates, Response, SearchResultItem
17
17
 
18
18
 
19
- __version__: str = version("perplexity-webui-scraper")
20
-
19
+ __version__: str = metadata.version("perplexity-webui-scraper")
21
20
  __all__: list[str] = [
22
- # Main client
23
- "Perplexity",
21
+ "AuthenticationError",
22
+ "CitationMode",
23
+ "ClientConfig",
24
24
  "Conversation",
25
- # Configuration
26
25
  "ConversationConfig",
27
- "ClientConfig",
28
26
  "Coordinates",
29
- # Enums
30
- "CitationMode",
31
- "SearchFocus",
32
- "SourceFocus",
33
- "TimeRange",
34
- # Models
35
- "Model",
36
- "Models",
37
- # Response types
38
- "Response",
39
- "SearchResultItem",
40
- # Exceptions
41
- "AuthenticationError",
42
27
  "FileUploadError",
43
28
  "FileValidationError",
29
+ "Model",
30
+ "Models",
31
+ "Perplexity",
44
32
  "PerplexityError",
45
33
  "RateLimitError",
34
+ "Response",
35
+ "SearchFocus",
36
+ "SearchResultItem",
37
+ "SourceFocus",
38
+ "TimeRange",
46
39
  ]