start API server Returns: True
()
| 658 | |
| 659 | |
| 660 | def start_api_server(): |
| 661 | """ |
| 662 | start API server |
| 663 | |
| 664 | Returns: |
| 665 | True |
| 666 | """ |
| 667 | # Starting the API |
| 668 | my_api_configuration = api_configuration() |
| 669 | api_access_key = my_api_configuration["api_access_key"] |
| 670 | api_access_without_key = my_api_configuration["api_access_without_key"] |
| 671 | |
| 672 | write_to_api_console( |
| 673 | " * API access key: {0}\n".format( |
| 674 | api_access_key if not api_access_without_key else "NOT REQUIRED!" |
| 675 | ) |
| 676 | ) |
| 677 | |
| 678 | app.config["OWASP_HONEYPOT_CONFIG"] = { |
| 679 | "api_access_key": api_access_key, |
| 680 | "api_client_white_list": my_api_configuration["api_client_white_list"]["enabled"], |
| 681 | "api_client_white_list_ips": my_api_configuration["api_client_white_list"]["ips"], |
| 682 | "api_access_log": my_api_configuration["api_access_log"]["enabled"], |
| 683 | "api_access_log_filename": my_api_configuration["api_access_log"]["filename"], |
| 684 | "api_access_without_key": api_access_without_key, |
| 685 | **user_configuration() |
| 686 | } |
| 687 | app.register_blueprint(documentation_settings) |
| 688 | |
| 689 | app.run( |
| 690 | host=my_api_configuration["api_host"], |
| 691 | port=my_api_configuration["api_port"], |
| 692 | debug=my_api_configuration["api_debug_mode"], |
| 693 | threaded=True |
| 694 | ) |
| 695 | return True |
no test coverage detected