class Analyzer::Python::Flask

Defined in:

analyzer/analyzers/python/flask.cr

Constant Summary

REQUEST_PARAM_FIELDS = {"data" => {["POST", "PUT", "PATCH", "DELETE"], "form"}, "args" => {["GET"], "query"}, "form" => {["POST", "PUT", "PATCH", "DELETE"], "form"}, "files" => {["POST", "PUT", "PATCH", "DELETE"], "form"}, "values" => {["GET", "POST", "PUT", "PATCH", "DELETE"], "query"}, "json" => {["POST", "PUT", "PATCH", "DELETE"], "json"}, "cookie" => {nil, "cookie"}, "headers" => {nil, "header"}}

Reference: https://stackoverflow.com/a/16664376 Reference: https://tedboy.github.io/flask/generated/generated/flask.Request.html

REQUEST_PARAM_TYPES = {"query" => nil, "form" => ["POST", "PUT", "PATCH", "DELETE"], "json" => ["POST", "PUT", "PATCH", "DELETE"], "cookie" => nil, "header" => nil}

Instance Method Summary

Instance methods inherited from class Analyzer::Python::Python

find_imported_modules(app_base_path : String, file_path : String, content : String | Nil = nil) : Hash(String, Tuple(String, Int32)) find_imported_modules, find_imported_package(package_path : String, dotted_as_names : String) : Array(Tuple(String, String, Int32)) find_imported_package, find_json_params(codeblock_lines : Array(String), json_var_names : Array(String)) : Array(Param) find_json_params, parse_code_block(data : String | Array(String), after : Regex | Nil = nil) : String | Nil parse_code_block, parse_function_def(source_lines : Array(String), start_index : Int32) : FunctionDefinition | Nil parse_function_def, return_literal_value(data : String) : String return_literal_value

Instance methods inherited from class Analyzer

analyze analyze, base_path : String base_path, logger : NoirLogger logger, result : Array(Endpoint) result, url : String url

Constructor methods inherited from class Analyzer

new(options : Hash(String, YAML::Any)) new

Macros inherited from class Analyzer

define_getter_methods(names) define_getter_methods

Instance Method Detail

def analyze #

[View source]
def create_parser(path : String, content : String = "") : PythonParser #

Create a Python parser for a given path and content


[View source]
def extract_params_from_decorator(path : String, lines : Array(String), line_index : Int32, direction : Symbol = :down) : Tuple(Array(Param), Int32) #

Extracts parameters from the decorator


[View source]
def get_endpoints(method : String, route_path : String, extra_params : String, codeblock_lines : Array(String), prefix : String) #

Extracts endpoint information from the given route and code block


[View source]
def get_filtered_params(method : String, params : Array(Param)) : Array(Param) #

Filters the parameters based on the HTTP method


[View source]
def get_parser(path : String, content : String = "") : PythonParser #

Get a parser for a given path


[View source]