diff --git a/llama-index-integrations/readers/llama-index-readers-wordpress/README.md b/llama-index-integrations/readers/llama-index-readers-wordpress/README.md index 51fd082c9c824..dc5287fd5bd72 100644 --- a/llama-index-integrations/readers/llama-index-readers-wordpress/README.md +++ b/llama-index-integrations/readers/llama-index-readers-wordpress/README.md @@ -8,7 +8,10 @@ This loader fetches the text from Wordpress blog posts using the Wordpress API. ## Usage -To use this loader, you need to pass base url of the Wordpress installation (e.g. `https://www.mysite.com`), a username, and an application password for the user (more about application passwords [here](https://www.paidmembershipspro.com/create-application-password-wordpress/)) +To use this loader, you need to pass base url of the Wordpress installation +(e.g. `https://www.mysite.com`) and optionally a username, and an application +password for the user (more about application passwords +[here](https://www.paidmembershipspro.com/create-application-password-wordpress/)) ```python from llama_index.readers.wordpress import WordpressReader diff --git a/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/base.py b/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/base.py index 2d494e32286eb..4d15db1b1d2a5 100644 --- a/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/base.py +++ b/llama-index-integrations/readers/llama-index-readers-wordpress/llama_index/readers/wordpress/base.py @@ -1,6 +1,6 @@ """Wordpress reader.""" import json -from typing import List +from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document @@ -13,7 +13,9 @@ class WordpressReader(BaseReader): wordpress_subdomain (str): Wordpress subdomain """ - def __init__(self, url: str, password: str, username: str) -> None: + def __init__( + self, url: str, password: Optional[str] = None, username: Optional[str] = None + ) -> None: """Initialize Wordpress reader.""" self.url = url self.username = username diff --git a/llama-index-integrations/readers/llama-index-readers-wordpress/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-wordpress/pyproject.toml index 0342f560f8155..aae05e3d27cfb 100644 --- a/llama-index-integrations/readers/llama-index-readers-wordpress/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-wordpress/pyproject.toml @@ -29,7 +29,7 @@ license = "MIT" maintainers = ["bbornsztein"] name = "llama-index-readers-wordpress" readme = "README.md" -version = "0.2.0" +version = "0.2.1" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" diff --git a/llama-index-integrations/readers/llama-index-readers-wordpress/tests/test_readers_wordpress.py b/llama-index-integrations/readers/llama-index-readers-wordpress/tests/test_readers_wordpress.py index 6d77c7bb8c274..82a58bc09548e 100644 --- a/llama-index-integrations/readers/llama-index-readers-wordpress/tests/test_readers_wordpress.py +++ b/llama-index-integrations/readers/llama-index-readers-wordpress/tests/test_readers_wordpress.py @@ -2,6 +2,14 @@ from llama_index.readers.wordpress import WordpressReader -def test_class(): +def test_class() -> None: names_of_base_classes = [b.__name__ for b in WordpressReader.__mro__] assert BaseReader.__name__ in names_of_base_classes + + +def test_allow_with_username_and_password() -> None: + wordpress_reader = WordpressReader("http://example.com", "user", "pass") + + +def test_allow_without_username_and_password() -> None: + wordpress_reader = WordpressReader("http://example.com")