We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This will allow for calling the submit function from a GUI.
diff --git a/mdd.py b/mdd.py index cb9f3c1..63eaf22 100644 --- a/mdd.py +++ b/mdd.py @@ -24,6 +24,22 @@ from dateutil import parser as date_parser inxi = None +def http_post_info(sys_info) -> bool: + try: + response = requests.post( + "https://metrics-api.manjaro.org/send", + json=sys_info, + headers={"Content-Type": "application/json"}, + timeout=2, + ) + + response.raise_for_status() + return True + except Exception as e: + logging.error(f"submitting telemetry: {e}") + return False + + def json_beaut(input, sort_keys=False): return json.dumps(input, indent=4, sort_keys=sort_keys) @@ -826,21 +842,11 @@ def main(): print("Note: Skipping data submission because of dry run.") return - try: - response = requests.post( - "https://metrics-api.manjaro.org/send", - json=data, - headers={"Content-Type": "application/json"}, - timeout=2, - ) - - response.raise_for_status() - except Exception as e: - logging.error(f"submitting telemetry: {e}") + if http_post_info(data): + print("Succesful sent at", datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + else: exit(1) - print("Succesful sent at", datetime.now().strftime("%Y-%m-%d %H:%M:%S")) - if __name__ == "__main__": main()
refactor-submission-to-function.txt
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This will allow for calling the submit function from a GUI.
refactor-submission-to-function.txt
The text was updated successfully, but these errors were encountered: