make_post_sell/test_requests_lib.py
Russell Ballestrini 800b7965b5 Fix crypto watcher stuck payments and improve cart deactivation
- 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>
2025-09-23 12:35:56 -04:00

37 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Test if the requests library works better than urllib for Digest auth.
If requests works, we can see what it does differently.
"""
try:
import requests
from requests.auth import HTTPDigestAuth
def test_with_requests():
print("=== Testing with requests library ===")
url = "http://127.0.0.1:18083/json_rpc"
payload = {"jsonrpc": "2.0", "id": 1, "method": "get_height"}
auth = HTTPDigestAuth("test_user", "test_pass")
try:
response = requests.post(url, json=payload, auth=auth, timeout=15)
if response.status_code == 200:
result = response.json()
print(f"✓ requests SUCCESS: {result}")
return True
else:
print(f"✗ requests FAILED: {response.status_code} {response.reason}")
print(f"Response: {response.text}")
return False
except Exception as e:
print(f"✗ requests ERROR: {e}")
return False
if __name__ == "__main__":
test_with_requests()
except ImportError:
print("requests library not installed. Install with: pip install requests")
print("This would help us compare urllib vs requests for Digest auth.")