clearfetch 1.0.0__tar.gz → 1.0.1__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.
@@ -1,16 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clearfetch
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Official Python SDK for ClearFetch (clearfetch.dev) - Unblocked Web & Anti-Bot Markdown/JSON Extraction for AI Agents.
5
5
  Author-email: ClearFetch Team <support@clearfetch.dev>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://clearfetch.dev
8
8
  Project-URL: Documentation, https://clearfetch.dev/docs
9
- Project-URL: Repository, https://github.com/clearfetch/clearfetch-python
9
+ Project-URL: Repository, https://github.com/zenkdom/clearfetch
10
10
  Keywords: clearfetch,web-scraper,anti-bot,cloudflare-turnstile,datadome,ai-agent,llm,langchain,llamaindex,rag
11
11
  Classifier: Development Status :: 5 - Production/Stable
12
12
  Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
@@ -3,7 +3,7 @@ from clearfetch.types import ReadResult, ExtractResult, SearchResult, SearchItem
3
3
  from clearfetch.integrations.langchain import ClearFetchLoader
4
4
  from clearfetch.integrations.llamaindex import ClearFetchReader
5
5
 
6
- __version__ = "1.0.0"
6
+ __version__ = "1.0.1"
7
7
 
8
8
  __all__ = [
9
9
  "ClearFetch",
@@ -30,7 +30,7 @@ class ClearFetch:
30
30
  self._headers = {
31
31
  "Authorization": f"Bearer {self.api_key}",
32
32
  "Content-Type": "application/json",
33
- "User-Agent": "ClearFetch-Python-SDK/1.0.0"
33
+ "User-Agent": "ClearFetch-Python-SDK/1.0.1"
34
34
  }
35
35
 
36
36
  def _handle_response(self, response: httpx.Response) -> Dict[str, Any]:
@@ -180,7 +180,7 @@ class AsyncClearFetch:
180
180
  self._headers = {
181
181
  "Authorization": f"Bearer {self.api_key}",
182
182
  "Content-Type": "application/json",
183
- "User-Agent": "ClearFetch-Python-AsyncSDK/1.0.0"
183
+ "User-Agent": "ClearFetch-Python-AsyncSDK/1.0.1"
184
184
  }
185
185
 
186
186
  def _handle_response(self, response: httpx.Response) -> Dict[str, Any]:
@@ -1,16 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clearfetch
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Official Python SDK for ClearFetch (clearfetch.dev) - Unblocked Web & Anti-Bot Markdown/JSON Extraction for AI Agents.
5
5
  Author-email: ClearFetch Team <support@clearfetch.dev>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://clearfetch.dev
8
8
  Project-URL: Documentation, https://clearfetch.dev/docs
9
- Project-URL: Repository, https://github.com/clearfetch/clearfetch-python
9
+ Project-URL: Repository, https://github.com/zenkdom/clearfetch
10
10
  Keywords: clearfetch,web-scraper,anti-bot,cloudflare-turnstile,datadome,ai-agent,llm,langchain,llamaindex,rag
11
11
  Classifier: Development Status :: 5 - Production/Stable
12
12
  Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
@@ -12,4 +12,5 @@ clearfetch.egg-info/requires.txt
12
12
  clearfetch.egg-info/top_level.txt
13
13
  clearfetch/integrations/__init__.py
14
14
  clearfetch/integrations/langchain.py
15
- clearfetch/integrations/llamaindex.py
15
+ clearfetch/integrations/llamaindex.py
16
+ tests/test_sdk.py
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "clearfetch"
7
- version = "1.0.0"
7
+ version = "1.0.1"
8
8
  description = "Official Python SDK for ClearFetch (clearfetch.dev) - Unblocked Web & Anti-Bot Markdown/JSON Extraction for AI Agents."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
- license = { text = "MIT" }
11
+ license = "MIT"
12
12
  authors = [
13
13
  { name = "ClearFetch Team", email = "support@clearfetch.dev" }
14
14
  ]
@@ -27,7 +27,6 @@ keywords = [
27
27
  classifiers = [
28
28
  "Development Status :: 5 - Production/Stable",
29
29
  "Intended Audience :: Developers",
30
- "License :: OSI Approved :: MIT License",
31
30
  "Programming Language :: Python :: 3",
32
31
  "Programming Language :: Python :: 3.9",
33
32
  "Programming Language :: Python :: 3.10",
@@ -48,7 +47,10 @@ all = ["langchain-core>=0.1.0", "llama-index-core>=0.10.0"]
48
47
  [project.urls]
49
48
  Homepage = "https://clearfetch.dev"
50
49
  Documentation = "https://clearfetch.dev/docs"
51
- Repository = "https://github.com/clearfetch/clearfetch-python"
50
+ Repository = "https://github.com/zenkdom/clearfetch"
52
51
 
53
52
  [project.scripts]
54
53
  clearfetch = "clearfetch.cli:main"
54
+
55
+ [tool.pytest.ini_options]
56
+ pythonpath = ["."]
@@ -0,0 +1,46 @@
1
+ import pytest
2
+ from clearfetch import ClearFetch, AsyncClearFetch
3
+ from clearfetch.types import Metadata, ReadResult, ExtractResult, SearchItem, SearchResult, UsageResult
4
+ from clearfetch.client import ClearFetchError
5
+
6
+ def test_client_init_requires_key():
7
+ with pytest.raises(ValueError, match="ClearFetch API key must be provided"):
8
+ ClearFetch(api_key=None)
9
+
10
+ def test_client_init_with_key():
11
+ client = ClearFetch(api_key="cf_live_test12345", base_url="https://api.clearfetch.dev/")
12
+ assert client.api_key == "cf_live_test12345"
13
+ assert client.base_url == "https://api.clearfetch.dev"
14
+ assert client._headers["Authorization"] == "Bearer cf_live_test12345"
15
+
16
+ def test_async_client_init_with_key():
17
+ async_client = AsyncClearFetch(api_key="cf_live_async12345")
18
+ assert async_client.api_key == "cf_live_async12345"
19
+ assert async_client.base_url == "https://api.clearfetch.dev"
20
+
21
+ def test_types_dataclasses():
22
+ meta = Metadata(
23
+ status_code=200,
24
+ cached=False,
25
+ stealth_used=True,
26
+ estimated_tokens=500,
27
+ latency_ms=120,
28
+ credits_used=1
29
+ )
30
+ read_res = ReadResult(
31
+ success=True,
32
+ url="https://example.com",
33
+ title="Example",
34
+ description="Desc",
35
+ markdown="# Content",
36
+ links=["https://example.com/about"],
37
+ metadata=meta
38
+ )
39
+ assert read_res.success is True
40
+ assert read_res.metadata.stealth_used is True
41
+
42
+ def test_error_class():
43
+ err = ClearFetchError("Unauthorized", status_code=401, details={"detail": "Bad Key"})
44
+ assert err.status_code == 401
45
+ assert err.details == {"detail": "Bad Key"}
46
+ assert str(err) == "Unauthorized"
File without changes
File without changes
File without changes