nexscope-ai/nexscope-ecommerce-skills / ecommerce-amazon-advertising-api
ecommerce.amazon-advertising-api
VerifiedAuthorize Amazon Ads accounts, manage SP, SB, and SD entities, and retrieve advertising reports.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 36.6 KB |
| manifest.json | config | 674 B |
| references/ads-report-types.json | config | 288.8 KB |
| references/api.json | config | 154.6 KB |
| references/api.md | markdown | 130.0 KB |
| references/testing.md | markdown | 2.6 KB |
| scripts/amazon_ads_report_workflow.py | script | 11.8 KB |
| scripts/amazon_api.py | script | 21.2 KB |
| scripts/amazon_connection.py | script | 2.4 KB |
scripts/amazon_connection.py
View on GitHub#!/usr/bin/env python3
"""Manage an Amazon connection without exposing provider credentials."""
import json, os, sys
from urllib.error import HTTPError, URLError
from urllib.parse import urlencode
from urllib.request import Request, urlopen
BASE = os.environ.get("NEXSCOPE_PROXY_BASE", "").strip().rstrip("/")
KEY = os.environ.get("NEXSCOPE_API_KEY", "").strip()
MAX_RESPONSE_BYTES = 32 * 1024 * 1024
ROUTES = {'authorize': ('POST', '/api/skill/amazon/connections/amazon-ads/authorize'), 'status': ('GET', '/api/skill/amazon/connections/amazon-ads/status'), 'connections': ('GET', '/api/skill/amazon/connections/amazon-ads'), 'profiles': ('GET', '/api/skill/amazon/connections/amazon-ads/profiles')}
def main():
if len(sys.argv) != 2:
raise ValueError("Provide exactly one JSON object argument")
params = json.loads(sys.argv[1])
if not isinstance(params, dict):
raise ValueError("The argument must be a JSON object")
action = str(params.pop("action", "authorize")).lower()
if action not in ROUTES:
raise ValueError("Unknown action")
method, path = ROUTES[action]
if not BASE or not KEY:
raise ValueError("NEXSCOPE_PROXY_BASE and NEXSCOPE_API_KEY are required")
data = None
if method == "GET":
if params:
path += "?" + urlencode(params)
else:
data = json.dumps(params).encode()
request = Request(BASE + path, data=data, headers={"Authorization": "Bearer " + KEY,
"Content-Type": "application/json", "Accept": "application/json"}, method=method)
try:
with urlopen(request, timeout=60) as response:
raw = response.read(MAX_RESPONSE_BYTES + 1)
if len(raw) > MAX_RESPONSE_BYTES: raise RuntimeError("Gateway response exceeds 32 MiB limit")
value = json.loads(raw.decode("utf-8"))
except HTTPError as error:
raise RuntimeError(f"Gateway HTTP {error.code}") from error
except URLError as error:
raise RuntimeError("Gateway request failed") from error
if not isinstance(value, dict) or value.get("code") != 0:
raise RuntimeError("Gateway application failure" if isinstance(value, dict) else "Invalid gateway response")
print(json.dumps(value.get("data"), indent=2, ensure_ascii=True))
if __name__ == "__main__":
try: main()
except (OSError, ValueError, RuntimeError, json.JSONDecodeError) as error:
print(json.dumps({"error": str(error)}), file=sys.stderr); raise SystemExit(1)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |