Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GNU nano 8.4 /home/pi/dc_outgoing.py
- #!/usr/bin/env python3
- import sys
- import urllib.request
- import urllib.error
- SERVICE_URL_BASE = "http://127.0.0.1:8765"
- def main():
- if len(sys.argv) < 2:
- print("Usage: dc_outgoing.py <extension>")
- sys.exit(1)
- ext = sys.argv[1].strip()
- url = f"{SERVICE_URL_BASE}/call/{ext}"
- print(f"[WRAPPER] Requesting call for {ext} via {url}")
- try:
- with urllib.request.urlopen(url, timeout=10) as resp:
- body = resp.read().decode("utf-8", errors="ignore")
- print(f"[WRAPPER] Service response: {resp.status} {body.strip()}")
- except urllib.error.URLError as e:
- print(f"[WRAPPER] Error contacting service: {e}")
- sys.exit(1)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment