surfaceapi 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Canada Site Ops
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: surfaceapi
3
+ Version: 0.1.0
4
+ Summary: Tiny client for Surface: usage-priced infrastructure for machine traffic (preflight, hop, pixel, inspect, MCP).
5
+ Author-email: Surface / Canada Site Ops <canada.site.ops@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://nova-otter-delta-cloud.grok.me
8
+ Project-URL: Source, https://github.com/Surface-ops/surface
9
+ Keywords: surface,mcp,agents,preflight,link-check,api
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # Surface clients
16
+
17
+ [![Surface](https://nova-otter-delta-cloud.grok.me/badge/surface.svg)](https://nova-otter-delta-cloud.grok.me)
18
+
19
+ Tiny clients for [Surface](https://nova-otter-delta-cloud.grok.me): usage-priced infrastructure for machine traffic (preflight, hop, pixel, inspect, MCP, badge). First 1M requests/month free.
20
+
21
+ - JavaScript: `npm install surfaceapi` ([clients/js](js))
22
+ - Python: `pip install surfaceapi` ([clients/python](python))
23
+
24
+ ## MCP
25
+ Add Surface to any MCP client:
26
+ ```json
27
+ { "mcpServers": { "surface": { "url": "https://nova-otter-delta-cloud.grok.me/mcp" } } }
28
+ ```
29
+
30
+ ## Python
31
+ ```python
32
+ from surfaceapi import Surface
33
+ key = Surface().create_key().get("key") # free key
34
+ s = Surface(api_key=key)
35
+ print(s.preflight("https://example.com"))
36
+ print(s.inspect())
37
+ ```
@@ -0,0 +1,23 @@
1
+ # Surface clients
2
+
3
+ [![Surface](https://nova-otter-delta-cloud.grok.me/badge/surface.svg)](https://nova-otter-delta-cloud.grok.me)
4
+
5
+ Tiny clients for [Surface](https://nova-otter-delta-cloud.grok.me): usage-priced infrastructure for machine traffic (preflight, hop, pixel, inspect, MCP, badge). First 1M requests/month free.
6
+
7
+ - JavaScript: `npm install surfaceapi` ([clients/js](js))
8
+ - Python: `pip install surfaceapi` ([clients/python](python))
9
+
10
+ ## MCP
11
+ Add Surface to any MCP client:
12
+ ```json
13
+ { "mcpServers": { "surface": { "url": "https://nova-otter-delta-cloud.grok.me/mcp" } } }
14
+ ```
15
+
16
+ ## Python
17
+ ```python
18
+ from surfaceapi import Surface
19
+ key = Surface().create_key().get("key") # free key
20
+ s = Surface(api_key=key)
21
+ print(s.preflight("https://example.com"))
22
+ print(s.inspect())
23
+ ```
@@ -0,0 +1,15 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+ [project]
5
+ name = "surfaceapi"
6
+ version = "0.1.0"
7
+ description = "Tiny client for Surface: usage-priced infrastructure for machine traffic (preflight, hop, pixel, inspect, MCP)."
8
+ readme = "README.md"
9
+ requires-python = ">=3.8"
10
+ license = {text = "MIT"}
11
+ authors = [{name = "Surface / Canada Site Ops", email = "canada.site.ops@gmail.com"}]
12
+ keywords = ["surface", "mcp", "agents", "preflight", "link-check", "api"]
13
+ [project.urls]
14
+ Homepage = "https://nova-otter-delta-cloud.grok.me"
15
+ Source = "https://github.com/Surface-ops/surface"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,43 @@
1
+ """Tiny client for Surface (https://nova-otter-delta-cloud.grok.me)."""
2
+ import json, urllib.request, urllib.error
3
+ __version__ = "0.1.0"
4
+ DEFAULT_BASE = "https://nova-otter-delta-cloud.grok.me"
5
+
6
+ class _NoRedirect(urllib.request.HTTPRedirectHandler):
7
+ def redirect_request(self, *a, **k): return None
8
+
9
+ class SurfaceError(Exception):
10
+ def __init__(self, status, data): super().__init__(f"Surface {status}"); self.status, self.data = status, data
11
+
12
+ class Surface:
13
+ def __init__(self, api_key=None, base_url=DEFAULT_BASE, headers=None):
14
+ self.api_key, self.base_url, self.headers = api_key, base_url.rstrip("/"), headers or {}
15
+ def _req(self, method, path, body=None):
16
+ h = {"User-Agent": f"surfaceapi-py/{__version__}", **self.headers}
17
+ if self.api_key: h["Authorization"] = "Bearer " + self.api_key
18
+ data = None
19
+ if body is not None: data = json.dumps(body).encode(); h["Content-Type"] = "application/json"
20
+ req = urllib.request.Request(self.base_url + path, data=data, headers=h, method=method)
21
+ opener = urllib.request.build_opener(_NoRedirect)
22
+ try: r = opener.open(req, timeout=30); status, hdrs, raw = r.status, r.headers, r.read()
23
+ except urllib.error.HTTPError as e:
24
+ status, hdrs, raw = e.code, e.headers, e.read()
25
+ if status >= 400:
26
+ try: d = json.loads(raw)
27
+ except Exception: d = raw.decode(errors="replace")
28
+ raise SurfaceError(status, d)
29
+ try: d = json.loads(raw)
30
+ except Exception: d = raw.decode(errors="replace")
31
+ return status, hdrs, d
32
+ def create_key(self, **opts):
33
+ """Get a free API key (first 1M requests/month free)."""
34
+ return self._req("POST", "/v1/keys", opts)[2]
35
+ def preflight(self, url): return self._req("POST", "/v1/preflight", {"url": url})[2]
36
+ def inspect(self): return self._req("GET", "/v1/inspect")[2]
37
+ def hop(self, code):
38
+ s, h, _ = self._req("GET", "/h/" + urllib.parse.quote(code)); return {"status": s, "location": h.get("Location")}
39
+ def pixel_url(self, code): return f"{self.base_url}/px/{urllib.parse.quote(code)}"
40
+ def usage(self): return self._req("GET", "/v1/usage")[2]
41
+
42
+ import urllib.parse # noqa: E402
43
+ __all__ = ["Surface", "SurfaceError", "DEFAULT_BASE"]
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: surfaceapi
3
+ Version: 0.1.0
4
+ Summary: Tiny client for Surface: usage-priced infrastructure for machine traffic (preflight, hop, pixel, inspect, MCP).
5
+ Author-email: Surface / Canada Site Ops <canada.site.ops@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://nova-otter-delta-cloud.grok.me
8
+ Project-URL: Source, https://github.com/Surface-ops/surface
9
+ Keywords: surface,mcp,agents,preflight,link-check,api
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # Surface clients
16
+
17
+ [![Surface](https://nova-otter-delta-cloud.grok.me/badge/surface.svg)](https://nova-otter-delta-cloud.grok.me)
18
+
19
+ Tiny clients for [Surface](https://nova-otter-delta-cloud.grok.me): usage-priced infrastructure for machine traffic (preflight, hop, pixel, inspect, MCP, badge). First 1M requests/month free.
20
+
21
+ - JavaScript: `npm install surfaceapi` ([clients/js](js))
22
+ - Python: `pip install surfaceapi` ([clients/python](python))
23
+
24
+ ## MCP
25
+ Add Surface to any MCP client:
26
+ ```json
27
+ { "mcpServers": { "surface": { "url": "https://nova-otter-delta-cloud.grok.me/mcp" } } }
28
+ ```
29
+
30
+ ## Python
31
+ ```python
32
+ from surfaceapi import Surface
33
+ key = Surface().create_key().get("key") # free key
34
+ s = Surface(api_key=key)
35
+ print(s.preflight("https://example.com"))
36
+ print(s.inspect())
37
+ ```
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ surfaceapi/__init__.py
5
+ surfaceapi.egg-info/PKG-INFO
6
+ surfaceapi.egg-info/SOURCES.txt
7
+ surfaceapi.egg-info/dependency_links.txt
8
+ surfaceapi.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ surfaceapi