fix: fix all bug
All checks were successful
Deploy App / Deploy to Web Server (push) Successful in 1m28s
All checks were successful
Deploy App / Deploy to Web Server (push) Successful in 1m28s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
import requests
|
||||
import json
|
||||
|
||||
|
||||
def send_post_request(ip_addr, message_name):
|
||||
@@ -9,13 +10,30 @@ def send_post_request(ip_addr, message_name):
|
||||
return response.text
|
||||
|
||||
|
||||
def get_pk(ip_addr):
|
||||
url = f"http://" + ip_addr + ":8002/get_pk"
|
||||
response = requests.get(url, timeout=1)
|
||||
print(response.text)
|
||||
json_pk = json.loads(response.text)
|
||||
payload = {"pkx": json_pk["pkx"], "pky": json_pk["pky"], "ip": ip_addr}
|
||||
response = requests.post("http://localhost:8002/recieve_pk", json=payload)
|
||||
|
||||
return response.text
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Send POST request to a specified IP.")
|
||||
parser.add_argument("ip_addr", help="IP address to send request to.")
|
||||
parser.add_argument("message_name", help="Message name to send.")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
response = get_pk(args.ip_addr)
|
||||
print(response)
|
||||
|
||||
response = send_post_request(args.ip_addr, args.message_name)
|
||||
|
||||
print(response)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user