- Exclude already-swept payments from watcher queue to prevent endless processing - Mark swept payments as "swept" status to remove from future cycles - Fix cart deactivation by ensuring shop/user objects are attached to session - Add debug logging for cart deactivation to track behavior - Resolves issue where confirmed payments were processed every 20 seconds indefinitely 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
80 lines
2.4 KiB
Python
80 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test different urllib approaches to identify the exact issue.
|
|
"""
|
|
import urllib.request
|
|
import urllib.error
|
|
import json
|
|
import http.client
|
|
|
|
|
|
def test_urllib_debug():
|
|
"""Test urllib with full HTTP debugging enabled"""
|
|
print("=== urllib with HTTP debugging ===")
|
|
|
|
# Enable debugging to see what's being sent
|
|
http.client.HTTPConnection.debuglevel = 1
|
|
|
|
rpc_url = "http://127.0.0.1:18083/json_rpc"
|
|
rpc_user = "test_user"
|
|
rpc_pass = "test_pass"
|
|
|
|
payload = {"jsonrpc": "2.0", "id": 1, "method": "get_height"}
|
|
data = json.dumps(payload).encode()
|
|
|
|
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
|
|
password_mgr.add_password(None, rpc_url, rpc_user, rpc_pass)
|
|
|
|
auth_handler = urllib.request.HTTPDigestAuthHandler(password_mgr)
|
|
opener = urllib.request.build_opener(auth_handler)
|
|
|
|
req = urllib.request.Request(
|
|
rpc_url, data=data, headers={"Content-Type": "application/json"}
|
|
)
|
|
|
|
try:
|
|
with opener.open(req) as resp:
|
|
result = json.loads(resp.read())
|
|
print(f"SUCCESS: {result}")
|
|
except Exception as e:
|
|
print(f"FAILED: {e}")
|
|
finally:
|
|
http.client.HTTPConnection.debuglevel = 0
|
|
|
|
|
|
def test_urllib_different_url():
|
|
"""Test if the issue is with the /json_rpc path"""
|
|
print("\n=== Testing different URL formats ===")
|
|
|
|
base_url = "http://127.0.0.1:18083"
|
|
paths = ["/json_rpc", "/json_rpc/", ""]
|
|
|
|
for path in paths:
|
|
print(f"\nTesting with path: {path!r}")
|
|
test_url = base_url + path if path else base_url
|
|
|
|
payload = {"jsonrpc": "2.0", "id": 1, "method": "get_height"}
|
|
data = json.dumps(payload).encode()
|
|
|
|
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
|
|
password_mgr.add_password(None, test_url, "test_user", "test_pass")
|
|
|
|
auth_handler = urllib.request.HTTPDigestAuthHandler(password_mgr)
|
|
opener = urllib.request.build_opener(auth_handler)
|
|
|
|
req = urllib.request.Request(
|
|
test_url, data=data, headers={"Content-Type": "application/json"}
|
|
)
|
|
|
|
try:
|
|
with opener.open(req) as resp:
|
|
result = json.loads(resp.read())
|
|
print(f" ✓ SUCCESS: {result}")
|
|
break
|
|
except Exception as e:
|
|
print(f" ✗ FAILED: {e}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_urllib_debug()
|
|
test_urllib_different_url()
|