Exceptions
All exceptions inherit from PerplexityError, allowing callers to catch the entire family with a single except PerplexityError clause.
perplexity_webui_scraper._internal.exceptions.PerplexityError
perplexity_webui_scraper._internal.exceptions.HTTPError
HTTPError(message: str, status_code: int | None = None, url: str | None = None, response_body: str | None = None)
Bases: PerplexityError
Raised when an HTTP request returns an unexpected status code.
| ATTRIBUTE | DESCRIPTION |
|---|---|
status_code |
HTTP status code, if available.
|
url |
Request URL, if available.
|
response_body |
First 500 characters of the response body, if available.
|
Source code in src/perplexity_webui_scraper/_internal/exceptions.py
perplexity_webui_scraper._internal.exceptions.AuthenticationError
Bases: HTTPError
Raised when the session token is invalid or expired (HTTP 403).
Source code in src/perplexity_webui_scraper/_internal/exceptions.py
perplexity_webui_scraper._internal.exceptions.RateLimitError
Bases: HTTPError
Raised when the Perplexity rate limit is exceeded (HTTP 429).
Source code in src/perplexity_webui_scraper/_internal/exceptions.py
perplexity_webui_scraper._internal.exceptions.FileUploadError
Bases: PerplexityError
Raised when a file upload to Perplexity's S3 bucket fails.
| ATTRIBUTE | DESCRIPTION |
|---|---|
file_path |
Display name or path of the file that failed to upload.
|
Source code in src/perplexity_webui_scraper/_internal/exceptions.py
perplexity_webui_scraper._internal.exceptions.FileValidationError
Bases: PerplexityError
Raised when a file fails local validation before upload.
| ATTRIBUTE | DESCRIPTION |
|---|---|
file_path |
Display name or path of the file that failed validation.
|
Source code in src/perplexity_webui_scraper/_internal/exceptions.py
perplexity_webui_scraper._internal.exceptions.ResearchClarifyingQuestionsError
Bases: PerplexityError
Raised when Research mode requires clarifying questions before answering.
Perplexity's Deep Research model may return a
RESEARCH_CLARIFYING_QUESTIONS SSE step instead of a final answer when
the query is ambiguous. The caller should catch this exception, present the
questions to the user, and retry with a more specific query.
| ATTRIBUTE | DESCRIPTION |
|---|---|
questions |
List of clarifying question strings extracted from the response.
|
Source code in src/perplexity_webui_scraper/_internal/exceptions.py
perplexity_webui_scraper._internal.exceptions.ResponseParsingError
Bases: PerplexityError
Raised when the API response cannot be parsed into a known structure.
| ATTRIBUTE | DESCRIPTION |
|---|---|
raw_data |
Stringified raw response data for debugging, if available.
|
Source code in src/perplexity_webui_scraper/_internal/exceptions.py
perplexity_webui_scraper._internal.exceptions.StreamingError
Bases: PerplexityError
Raised when an error occurs during SSE streaming.