Skip to content

Commit 369f143

Browse files
authored
Merge pull request #8 from JigsawStack/check
Updates Web class
2 parents 737501f + 815036f commit 369f143

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

jigsawstack/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def __init__(self, api_key: Union[str, None] = None, api_url: Union[str, None] =
5353

5454
self.audio = Audio(api_key=api_key, api_url=api_url)
5555
self.web = Web(api_key=api_key, api_url=api_url)
56-
self.search = Search(api_key=api_key, api_url=api_url)
5756
self.sentiment = Sentiment(api_key=api_key, api_url=api_url)
5857
self.validate = Validate(api_key=api_key, api_url=api_url)
5958
self.summary = Summary(api_key=api_key, api_url=api_url)
@@ -67,4 +66,4 @@ def __init__(self, api_key: Union[str, None] = None, api_url: Union[str, None] =
6766
self.prompt_engine = PromptEngine(api_key=api_key, api_url=api_url)
6867

6968
# Create a global instance of the Web class
70-
__all__ = ["JigsawStack"]
69+
__all__ = ["JigsawStack", "Search"]

jigsawstack/search.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from ._config import ClientConfig
66

77

8-
class SearchAIResponse(TypedDict):
8+
class SearchResponse(TypedDict):
99
success: bool
1010
"""
1111
Indicates whether the translation was successful.
@@ -35,7 +35,7 @@ class SearchSuggestionParams(TypedDict):
3535
The search value. The maximum query character length is 200.
3636
"""
3737

38-
class AISearchParams(TypedDict):
38+
class SearchParams(TypedDict):
3939
query: str
4040
"""
4141
The search value. The maximum query character length is 200.
@@ -55,7 +55,7 @@ class AISearchParams(TypedDict):
5555

5656

5757
class Search(ClientConfig):
58-
def ai_search(self,params: AISearchParams) -> SearchAIResponse:
58+
def search(self,params: SearchParams) -> SearchResponse:
5959
query = params["query"]
6060
ai_overview = params.get("ai_overview", "True")
6161
safe_search = params.get("safe_search","moderate")
@@ -67,7 +67,6 @@ def ai_search(self,params: AISearchParams) -> SearchAIResponse:
6767
path=path, params=cast(Dict[Any, Any], params), verb="GET"
6868
).perform_with_content()
6969

70-
print(resp)
7170
return resp
7271

7372

@@ -79,6 +78,4 @@ def suggestion(self, params: SearchSuggestionParams) -> SearchSuggestionResponse
7978
api_url=self.api_url,
8079
path=path, params=cast(Dict[Any, Any], params), verb="GET"
8180
).perform_with_content()
82-
83-
print(resp)
8481
return resp

jigsawstack/web.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing_extensions import NotRequired, TypedDict
33
from .request import Request
44
from ._config import ClientConfig
5-
5+
from .search import Search,SearchParams, SearchSuggestionParams, SearchSuggestionResponse, SearchResponse
66
class DNSParams(TypedDict):
77
domain:str
88
type : NotRequired[str]
@@ -128,4 +128,12 @@ def dns(self, params: DNSParams) -> DNSResponse:
128128
api_url=self.api_url,
129129
path=path, params=cast(Dict[Any, Any], params), verb="get"
130130
).perform_with_content()
131-
return resp
131+
return resp
132+
133+
def search(self, params: SearchParams) -> SearchResponse:
134+
s = Search(self.api_key, self.api_url)
135+
return s.search(params)
136+
137+
def search_suggestion(self, params: SearchSuggestionParams) -> SearchSuggestionResponse:
138+
s = Search(self.api_key, self.api_url)
139+
return s.suggestion(params)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="jigsawstack",
9-
version="0.1.2",
9+
version="0.1.3",
1010
description="JigsawStack Python SDK",
1111
long_description=open("README.md", encoding="utf8").read(),
1212
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)