dify-nory 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,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: dify-nory
3
+ Version: 0.1.0
4
+ Summary: Dify tools for x402 payments - let workflows pay for APIs
5
+ Author-email: Nory <hello@noryx402.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://noryx402.com
8
+ Project-URL: Repository, https://github.com/TheMemeBanker/dify-nory
9
+ Keywords: dify,ai-agents,payments,x402,solana,workflows
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: pydantic>=2.0.0
16
+ Requires-Dist: requests>=2.28.0
17
+
18
+ # dify-nory
19
+
20
+ **Dify tools for x402 payments** - Let your workflows pay for APIs.
21
+
22
+ ## Install
23
+ ```bash
24
+ pip install dify-nory
25
+ ```
26
+
27
+ ## Usage
28
+ ```python
29
+ from dify_nory import NoryCryptoPricesTool, NoryWeatherTool
30
+
31
+ crypto_tool = NoryCryptoPricesTool()
32
+ result = crypto_tool._invoke("BTC,ETH,SOL")
33
+ ```
34
+
35
+ ## Tools
36
+ - `NoryTool` - Fetch any URL with auto payment
37
+ - `NoryCryptoPricesTool` - Real-time crypto ($0.001)
38
+ - `NoryWeatherTool` - Weather forecast ($0.002)
39
+
40
+ Set `NORY_WALLET_KEY` env var. [Docs](https://noryx402.com)
@@ -0,0 +1,23 @@
1
+ # dify-nory
2
+
3
+ **Dify tools for x402 payments** - Let your workflows pay for APIs.
4
+
5
+ ## Install
6
+ ```bash
7
+ pip install dify-nory
8
+ ```
9
+
10
+ ## Usage
11
+ ```python
12
+ from dify_nory import NoryCryptoPricesTool, NoryWeatherTool
13
+
14
+ crypto_tool = NoryCryptoPricesTool()
15
+ result = crypto_tool._invoke("BTC,ETH,SOL")
16
+ ```
17
+
18
+ ## Tools
19
+ - `NoryTool` - Fetch any URL with auto payment
20
+ - `NoryCryptoPricesTool` - Real-time crypto ($0.001)
21
+ - `NoryWeatherTool` - Weather forecast ($0.002)
22
+
23
+ Set `NORY_WALLET_KEY` env var. [Docs](https://noryx402.com)
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dify-nory"
7
+ version = "0.1.0"
8
+ description = "Dify tools for x402 payments - let workflows pay for APIs"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [{name = "Nory", email = "hello@noryx402.com"}]
12
+ keywords = ["dify", "ai-agents", "payments", "x402", "solana", "workflows"]
13
+ classifiers = ["Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3"]
14
+ requires-python = ">=3.9"
15
+ dependencies = ["pydantic>=2.0.0", "requests>=2.28.0"]
16
+
17
+ [project.urls]
18
+ Homepage = "https://noryx402.com"
19
+ Repository = "https://github.com/TheMemeBanker/dify-nory"
20
+
21
+ [tool.setuptools.packages.find]
22
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ """Dify Nory x402 Tools - Payment tools for Dify workflows."""
2
+ from dify_nory.tools import NoryTool, NoryCryptoPricesTool, NoryWeatherTool
3
+ __version__ = "0.1.0"
4
+ __all__ = ["NoryTool", "NoryCryptoPricesTool", "NoryWeatherTool"]
@@ -0,0 +1,67 @@
1
+ """Dify tools for Nory x402 payments."""
2
+ import os, json, requests
3
+ from typing import Optional, Any
4
+ from pydantic import BaseModel, Field
5
+
6
+ NORY_BASE_URL = "https://noryx402.com"
7
+
8
+ def _make_paid_request(url: str, wallet_key: Optional[str] = None) -> dict:
9
+ key = wallet_key or os.environ.get("NORY_WALLET_KEY")
10
+ headers = {"Accept": "application/json"}
11
+ response = requests.get(url, headers=headers)
12
+ if response.status_code == 402:
13
+ if not key:
14
+ return {"error": "Payment required but no wallet key"}
15
+ requirements = response.json()
16
+ payment_response = requests.post(f"{NORY_BASE_URL}/api/x402/pay",
17
+ json={"requirements": requirements, "walletKey": key, "network": "solana-mainnet"},
18
+ headers={"Content-Type": "application/json"})
19
+ if payment_response.status_code != 200:
20
+ return {"error": "Payment failed"}
21
+ payment_data = payment_response.json()
22
+ headers["X-PAYMENT"] = payment_data.get("paymentHeader", "")
23
+ final_response = requests.get(url, headers=headers)
24
+ try:
25
+ return {"success": True, "data": final_response.json()}
26
+ except:
27
+ return {"success": True, "data": final_response.text}
28
+ try:
29
+ return {"success": True, "data": response.json()}
30
+ except:
31
+ return {"success": True, "data": response.text}
32
+
33
+ class NoryToolInput(BaseModel):
34
+ url: str = Field(description="URL to fetch with payment")
35
+
36
+ class NoryTool:
37
+ """Base Dify tool for x402 payments."""
38
+ name: str = "nory_fetch"
39
+ description: str = "Fetch any URL with automatic x402 payment using USDC on Solana"
40
+
41
+ def __init__(self, wallet_key: Optional[str] = None):
42
+ self.wallet_key = wallet_key or os.environ.get("NORY_WALLET_KEY")
43
+
44
+ def _invoke(self, url: str) -> str:
45
+ return json.dumps(_make_paid_request(url, self.wallet_key))
46
+
47
+ class NoryCryptoPricesTool:
48
+ """Get real-time crypto prices. $0.001 per request."""
49
+ name: str = "nory_crypto_prices"
50
+ description: str = "Get real-time cryptocurrency prices from CoinGecko. Costs $0.001 USDC."
51
+
52
+ def __init__(self, wallet_key: Optional[str] = None):
53
+ self.wallet_key = wallet_key or os.environ.get("NORY_WALLET_KEY")
54
+
55
+ def _invoke(self, symbols: str = "BTC,ETH,SOL") -> str:
56
+ return json.dumps(_make_paid_request(f"{NORY_BASE_URL}/api/paid/live-crypto?symbols={symbols}", self.wallet_key))
57
+
58
+ class NoryWeatherTool:
59
+ """Get weather and forecast. $0.002 per request."""
60
+ name: str = "nory_weather"
61
+ description: str = "Get current weather and 7-day forecast. Costs $0.002 USDC."
62
+
63
+ def __init__(self, wallet_key: Optional[str] = None):
64
+ self.wallet_key = wallet_key or os.environ.get("NORY_WALLET_KEY")
65
+
66
+ def _invoke(self, city: str) -> str:
67
+ return json.dumps(_make_paid_request(f"{NORY_BASE_URL}/api/paid/weather?city={city}", self.wallet_key))
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: dify-nory
3
+ Version: 0.1.0
4
+ Summary: Dify tools for x402 payments - let workflows pay for APIs
5
+ Author-email: Nory <hello@noryx402.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://noryx402.com
8
+ Project-URL: Repository, https://github.com/TheMemeBanker/dify-nory
9
+ Keywords: dify,ai-agents,payments,x402,solana,workflows
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: pydantic>=2.0.0
16
+ Requires-Dist: requests>=2.28.0
17
+
18
+ # dify-nory
19
+
20
+ **Dify tools for x402 payments** - Let your workflows pay for APIs.
21
+
22
+ ## Install
23
+ ```bash
24
+ pip install dify-nory
25
+ ```
26
+
27
+ ## Usage
28
+ ```python
29
+ from dify_nory import NoryCryptoPricesTool, NoryWeatherTool
30
+
31
+ crypto_tool = NoryCryptoPricesTool()
32
+ result = crypto_tool._invoke("BTC,ETH,SOL")
33
+ ```
34
+
35
+ ## Tools
36
+ - `NoryTool` - Fetch any URL with auto payment
37
+ - `NoryCryptoPricesTool` - Real-time crypto ($0.001)
38
+ - `NoryWeatherTool` - Weather forecast ($0.002)
39
+
40
+ Set `NORY_WALLET_KEY` env var. [Docs](https://noryx402.com)
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/dify_nory/__init__.py
4
+ src/dify_nory/tools.py
5
+ src/dify_nory.egg-info/PKG-INFO
6
+ src/dify_nory.egg-info/SOURCES.txt
7
+ src/dify_nory.egg-info/dependency_links.txt
8
+ src/dify_nory.egg-info/requires.txt
9
+ src/dify_nory.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ pydantic>=2.0.0
2
+ requests>=2.28.0
@@ -0,0 +1 @@
1
+ dify_nory