snaprender 0.2.2__tar.gz → 0.2.3__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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snaprender
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Official Python SDK for SnapRender Screenshot API
5
5
  Project-URL: Homepage, https://snap-render.com
6
6
  Project-URL: Documentation, https://snap-render.com/docs
@@ -63,7 +63,8 @@ jpg = snap.capture(
63
63
 
64
64
  # Check cache status
65
65
  info = snap.info("https://example.com")
66
- print(info["cached"]) # True/False
66
+ print(info["cached"]) # True/False
67
+ print(info["expires_at"]) # ISO date string (when cached)
67
68
 
68
69
  # Get usage
69
70
  usage = snap.usage()
@@ -105,7 +106,7 @@ with SnapRender(api_key="sk_live_...") as snap:
105
106
 
106
107
  ### `snap.info(url)` -> `dict`
107
108
 
108
- Check if a screenshot is cached without capturing.
109
+ Check if a screenshot is cached without capturing. Returns `{ url, cached, cache_key, cached_at, expires_at, content_type }`.
109
110
 
110
111
  ### `snap.usage()` -> `dict`
111
112
 
@@ -49,7 +49,8 @@ jpg = snap.capture(
49
49
 
50
50
  # Check cache status
51
51
  info = snap.info("https://example.com")
52
- print(info["cached"]) # True/False
52
+ print(info["cached"]) # True/False
53
+ print(info["expires_at"]) # ISO date string (when cached)
53
54
 
54
55
  # Get usage
55
56
  usage = snap.usage()
@@ -91,7 +92,7 @@ with SnapRender(api_key="sk_live_...") as snap:
91
92
 
92
93
  ### `snap.info(url)` -> `dict`
93
94
 
94
- Check if a screenshot is cached without capturing.
95
+ Check if a screenshot is cached without capturing. Returns `{ url, cached, cache_key, cached_at, expires_at, content_type }`.
95
96
 
96
97
  ### `snap.usage()` -> `dict`
97
98
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "snaprender"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Official Python SDK for SnapRender Screenshot API"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -104,12 +104,24 @@ class SnapRender:
104
104
  return resp.content
105
105
 
106
106
  def info(self, url: str, **kwargs: Any) -> dict[str, Any]:
107
- """Get cache info for a URL without capturing."""
107
+ """Get cache info for a URL without capturing.
108
+
109
+ Returns a dict with keys: url, cached, cache_key, cached_at,
110
+ expires_at, content_type.
111
+ """
108
112
  params: dict[str, Any] = {"url": url, **kwargs}
109
113
  resp = self._client.get("/v1/screenshot/info", params=params)
110
114
  if resp.status_code != 200:
111
115
  self._raise_error(resp)
112
- return resp.json()
116
+ data = resp.json()
117
+ return {
118
+ "url": data["url"],
119
+ "cached": data["cached"],
120
+ "cache_key": data.get("cache_key"),
121
+ "cached_at": data.get("cached_at"),
122
+ "expires_at": data.get("expires_at"),
123
+ "content_type": data.get("content_type"),
124
+ }
113
125
 
114
126
  def usage(self) -> dict[str, Any]:
115
127
  """Get current month's usage.
File without changes
File without changes