Compare commits
No commits in common. "6300004ec389bb5cddddd5293efc7253a3ce64c6de3971f174077bfde48a9489" and "50721114e3b077ed6a499c708f1b6545211f3bcb008fbb76f064edd26fa0f704" have entirely different histories.
6300004ec3
...
50721114e3
@ -15,6 +15,7 @@ def send_post_request(uri, data):
|
||||
except requests.exceptions.RequestException as e:
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Read JSON files and send them as POST requests to simulate a webhook request."
|
||||
@ -40,16 +41,6 @@ def main():
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.mode == "send_one":
|
||||
if os.path.isfile(args.directory) and args.directory.endswith(".json"):
|
||||
with open(args.directory, "r", encoding="utf-8") as file:
|
||||
try:
|
||||
data = json.load(file)
|
||||
print(f"Sending {args.directory} to {args.uri}")
|
||||
send_post_request(args.uri, data)
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Error reading {args.directory}: {e}")
|
||||
return
|
||||
|
||||
if not os.path.exists(args.directory):
|
||||
print(f"Directory {args.directory} does not exist.")
|
||||
|
Loading…
Reference in New Issue
Block a user