Best Python code snippet using localstack_python
apigatewaysetup.py
Source:apigatewaysetup.py  
...41                #         "#if($input.params(\"Cookie\") && $input.params(\"Cookie\") != \"\") "42                #         "{"43                #         "\"body\": $input.body, "44                #         "\"token\": \"$input.params(\"Cookie\")\", "45                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "46                #         "\"method\": \"$context.httpMethod\","47                #         "\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "48                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\" #if($foreach.hasNext),#end #end}"49                #         "}"50                #         "#else"51                #         "{"52                #         "\"body\": $input.body, "53                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "54                #         "\"method\": \"$context.httpMethod\","55                #         "\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "56                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\"#if($foreach.hasNext),#end #end}"57                #         "}"58                #         "#end"59                #     )60                # }61            )62            # Put a 200 method response in the POST method63            api_gateway.put_method_response(64                restApiId=rest_api_id,65                resourceId=rest_api_root_id,66                httpMethod="POST",67                statusCode="200",68                responseParameters={69                    "method.response.header.Set-Cookie": False,70                    "method.response.header.Access-Control-Allow-Credentials": False,71                    "method.response.header.Access-Control-Allow-Origin": False72                },73                responseModels={74                    "application/json": "Empty"75                }76            )77            # # Put a 200 integration response in the POST method78            # api_gateway.put_integration_response(79            #     restApiId=rest_api_id,80            #     resourceId=rest_api_root_id,81            #     httpMethod="POST",82            #     statusCode="200",83            #     responseParameters={84            #         "method.response.header.Set-Cookie": (85            #             "integration.response.body.Set-Cookie"),86            #         "method.response.header.Access-Control-Allow-Credentials": (87            #             "\'true\'"),88            #         "method.response.header.Access-Control-Allow-Origin": (89            #             "\'https://s3.amazonaws.com\'")90            #     },91            #     responseTemplates={92            #         "application/json": "$input.path('$.body')"93            #     }94            # )95            # Put a 400 method response in the POST method96            api_gateway.put_method_response(97                restApiId=rest_api_id,98                resourceId=rest_api_root_id,99                httpMethod="POST",100                statusCode="400",101                responseParameters={102                    "method.response.header.Access-Control-Allow-Credentials": False,103                    "method.response.header.Access-Control-Allow-Origin": False104                },105                responseModels={106                    "application/json": "Empty"107                }108            )109            # # Put a 400 integration response in the POST method110            # api_gateway.put_integration_response(111            #     restApiId=rest_api_id,112            #     resourceId=rest_api_root_id,113            #     httpMethod="POST",114            #     statusCode="400",115            #     selectionPattern=".*'status': 400.*",116            #     responseParameters={117            #         "method.response.header.Access-Control-Allow-Credentials": (118            #             "\'true\'"),119            #         "method.response.header.Access-Control-Allow-Origin": (120            #             "\'https://s3.amazonaws.com\'")121            #     },122            #     responseTemplates={123            #         "application/json": "$input.path('$.errorMessage')"124            #     }125            # )126            # print "POST method added"127        except botocore.exceptions.ClientError as e:128            print e.response["Error"]["Code"]129            print e.response["Error"]["Message"]130            sys.exit()131        self.create_api_permissions_uri()132        self.create_api_url()133    @staticmethod134    def create_get_method(self, api_gateway, rest_api_id, rest_api_root_id):135        """136               Creates the get method and links it to the lambda function.137               :param api_gateway: api gateway reference from boto3.client("apigateway")138               :param rest_api_id: id of API gateway139               :param rest_api_root_id: id of API parent path140        """141        print "Adding GET method to rest api"142        try:143            # Add a POST method to the rest api144            api_gateway.put_method(145                restApiId=rest_api_id,146                resourceId=rest_api_root_id,147                httpMethod="GET",148                authorizationType="NONE",149                requestParameters={150                    "method.request.header.Cookie": False151                }152            )153            # Put integration in the GET method154            api_gateway.put_integration(155                restApiId=rest_api_id,156                resourceId=rest_api_root_id,157                httpMethod="GET",158                type="AWS_PROXY",159                passthroughBehavior="NEVER",160                integrationHttpMethod="POST",161                uri=self.constants["API_INVOCATION_URI"]162                # requestTemplates={163                #     "application/json": (164                #         "#if($input.params(\"Cookie\") && $input.params(\"Cookie\") != \"\") "165                #         "{"166                #         "\"body\": $input.body, "167                #         "\"token\": \"$input.params(\"Cookie\")\", "168                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "169                #         "\"method\": \"$context.httpMethod\",\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "170                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\" #if($foreach.hasNext),#end #end}"171                #         "}"172                #         "#else"173                #         "{"174                #         "\"body\": $input.body, "175                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "176                #         "\"method\": \"$context.httpMethod\",\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "177                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\"#if($foreach.hasNext),#end #end}"178                #         "}"179                #         "#end"180                #     )181                # }182            )183            # Put a 200 method response in the POST method184            api_gateway.put_method_response(185                restApiId=rest_api_id,186                resourceId=rest_api_root_id,187                httpMethod="GET",188                statusCode="200",189                responseParameters={190                    "method.response.header.Set-Cookie": False,191                    "method.response.header.Access-Control-Allow-Credentials": False,192                    "method.response.header.Access-Control-Allow-Origin": False193                },194                responseModels={195                    "application/json": "Empty"196                }197            )198            # # Put a 200 integration response in the GET method199            # api_gateway.put_integration_response(200            #     restApiId=rest_api_id,201            #     resourceId=rest_api_root_id,202            #     httpMethod="GET",203            #     statusCode="200",204            #     responseParameters={205            #         "method.response.header.Set-Cookie": (206            #             "integration.response.body.Set-Cookie"),207            #         "method.response.header.Access-Control-Allow-Credentials": (208            #             "\'true\'"),209            #         "method.response.header.Access-Control-Allow-Origin": (210            #             "\'https://s3.amazonaws.com\'")211            #     },212            #     responseTemplates={213            #         "application/json": "$input.path('$.body')"214            #     }215            # )216            # Put a 400 method response in the GET method217            api_gateway.put_method_response(218                restApiId=rest_api_id,219                resourceId=rest_api_root_id,220                httpMethod="GET",221                statusCode="400",222                responseParameters={223                    "method.response.header.Access-Control-Allow-Credentials": False,224                    "method.response.header.Access-Control-Allow-Origin": False225                },226                responseModels={227                    "application/json": "Empty"228                }229            )230            # # Put a 400 integration response in the GET method231            # api_gateway.put_integration_response(232            #     restApiId=rest_api_id,233            #     resourceId=rest_api_root_id,234            #     httpMethod="GET",235            #     statusCode="400",236            #     selectionPattern=".*'status': 400.*",237            #     responseParameters={238            #         "method.response.header.Access-Control-Allow-Credentials": (239            #             "\'true\'"),240            #         "method.response.header.Access-Control-Allow-Origin": (241            #             "\'https://s3.amazonaws.com\'")242            #     },243            #     responseTemplates={244            #         "application/json": "$input.path('$.errorMessage')"245            #     }246            # )247            print "GET method added"248        except botocore.exceptions.ClientError as e:249            print e.response["Error"]["Code"]250            print e.response["Error"]["Message"]251            sys.exit()252        self.create_api_permissions_uri()253        self.create_api_url()254    @staticmethod255    def create_delete_method(self, api_gateway, rest_api_id, rest_api_root_id):256        """257               Creates the delete method and links it to the lambda function.258               :param api_gateway: api gateway reference from boto3.client("apigateway")259               :param rest_api_id: id of API gateway260               :param rest_api_root_id: id of API parent path261        """262        print "Adding DELETE method to rest api"263        try:264            # Add a DELETE method to the rest api265            api_gateway.put_method(266                restApiId=rest_api_id,267                resourceId=rest_api_root_id,268                httpMethod="DELETE",269                authorizationType="NONE",270                requestParameters={271                    "method.request.header.Cookie": False272                }273            )274            # Put integration in the POST method275            api_gateway.put_integration(276                restApiId=rest_api_id,277                resourceId=rest_api_root_id,278                httpMethod="DELETE",279                type="AWS_PROXY",280                passthroughBehavior="NEVER",281                integrationHttpMethod="POST",282                uri=self.constants["API_INVOCATION_URI"]283                # requestTemplates={284                #     "application/json": (285                #         "#if($input.params(\"Cookie\") && $input.params(\"Cookie\") != \"\") "286                #         "{"287                #         "\"body\": $input.body, "288                #         "\"token\": \"$input.params(\"Cookie\")\", "289                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "290                #         "\"method\": \"$context.httpMethod\",\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "291                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\" #if($foreach.hasNext),#end #end}"292                #         "}"293                #         "#else"294                #         "{"295                #         "\"body\": $input.body, "296                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "297                #         "\"method\": \"$context.httpMethod\",\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "298                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\"#if($foreach.hasNext),#end #end}"299                #         "}"300                #         "#end"301                #     )302                # }303            )304            # Put a 200 method response in the DELETE method305            api_gateway.put_method_response(306                restApiId=rest_api_id,307                resourceId=rest_api_root_id,308                httpMethod="DELETE",309                statusCode="200",310                responseParameters={311                    "method.response.header.Set-Cookie": False,312                    "method.response.header.Access-Control-Allow-Credentials": False,313                    "method.response.header.Access-Control-Allow-Origin": False314                },315                responseModels={316                    "application/json": "Empty"317                }318            )319            # # Put a 200 integration response in the DELETE method320            # api_gateway.put_integration_response(321            #     restApiId=rest_api_id,322            #     resourceId=rest_api_root_id,323            #     httpMethod="DELETE",324            #     statusCode="200",325            #     responseParameters={326            #         "method.response.header.Set-Cookie": (327            #             "integration.response.body.Set-Cookie"),328            #         "method.response.header.Access-Control-Allow-Credentials": (329            #             "\'true\'"),330            #         "method.response.header.Access-Control-Allow-Origin": (331            #             "\'https://s3.amazonaws.com\'")332            #     },333            #     responseTemplates={334            #         "application/json": "$input.path('$.body')"335            #     }336            # )337            # Put a 400 method response in the DELETE method338            api_gateway.put_method_response(339                restApiId=rest_api_id,340                resourceId=rest_api_root_id,341                httpMethod="DELETE",342                statusCode="400",343                responseParameters={344                    "method.response.header.Access-Control-Allow-Credentials": False,345                    "method.response.header.Access-Control-Allow-Origin": False346                },347                responseModels={348                    "application/json": "Empty"349                }350            )351            # # Put a 400 integration response in the DELETE method352            # api_gateway.put_integration_response(353            #     restApiId=rest_api_id,354            #     resourceId=rest_api_root_id,355            #     httpMethod="DELETE",356            #     statusCode="400",357            #     selectionPattern=".*\"status\": 400.*",358            #     responseParameters={359            #         "method.response.header.Access-Control-Allow-Credentials": (360            #             "\'true\'"),361            #         "method.response.header.Access-Control-Allow-Origin": (362            #             "\'https://s3.amazonaws.com\'")363            #     },364            #     responseTemplates={365            #         "application/json": "$input.path('$.errorMessage')"366            #     }367            # )368            print "DELETE method added"369        except botocore.exceptions.ClientError as e:370            print e.response["Error"]["Code"]371            print e.response["Error"]["Message"]372            sys.exit()373        self.create_api_permissions_uri()374        self.create_api_url()375    @staticmethod376    def create_put_method(self, api_gateway, rest_api_id, rest_api_root_id):377        """378               Creates the put method and links it to the lambda function.379               :param api_gateway: api gateway reference from boto3.client("apigateway")380               :param rest_api_id: id of API gateway381               :param rest_api_root_id: id of API parent path382        """383        print "Adding PUT method to rest api"384        try:385            # Add a PUT method to the rest api386            api_gateway.put_method(387                restApiId=rest_api_id,388                resourceId=rest_api_root_id,389                httpMethod="PUT",390                authorizationType="NONE",391                requestParameters={392                    "method.request.header.Cookie": False393                }394            )395            # Put integration in the PUT method396            api_gateway.put_integration(397                restApiId=rest_api_id,398                resourceId=rest_api_root_id,399                httpMethod="PUT",400                type="AWS_PROXY",401                passthroughBehavior="NEVER",402                integrationHttpMethod="POST",403                uri=self.constants["API_INVOCATION_URI"]404                # requestTemplates={405                #     "application/json": (406                #         "#if($input.params(\"Cookie\") && $input.params(\"Cookie\") != \"\") "407                #         "{"408                #         "\"body\": $input.body, "409                #         "\"token\": \"$input.params(\"Cookie\")\", "410                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "411                #         "\"method\": \"$context.httpMethod\",\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "412                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\" #if($foreach.hasNext),#end #end}"413                #         "}"414                #         "#else"415                #         "{"416                #         "\"body\": $input.body, "417                #         "\"headers\": { #foreach($header in $input.params().header.keySet()) \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end #end}, "418                #         "\"method\": \"$context.httpMethod\",\"params\": { #foreach($param in $input.params().path.keySet()) \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end #end }, "419                #         "\"query\": { #foreach($queryParam in $input.params().querystring.keySet()) \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\"#if($foreach.hasNext),#end #end}"420                #         "}"421                #         "#end"422                #     )423                # }424            )425            # Put a 200 method response in the PUT method426            api_gateway.put_method_response(427                restApiId=rest_api_id,428                resourceId=rest_api_root_id,429                httpMethod="PUT",430                statusCode="200",431                responseParameters={432                    "method.response.header.Set-Cookie": False,433                    "method.response.header.Access-Control-Allow-Credentials": False,...lambda-deploy.py
Source:lambda-deploy.py  
...224          "uri" : "@replace_lambda_function_url",225          "passthroughBehavior" : "when_no_templates",226          "httpMethod" : "POST",227          "requestTemplates" : {228            "application/json" : "{\n  \"method\": \"$context.httpMethod\",\n  \"body\" : $input.json('$'),\n  \"headers\": {\n    #foreach($param in $input.params().header.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"queryParams\": {\n    #foreach($param in $input.params().querystring.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().querystring.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"pathParams\": {\n    #foreach($param in $input.params().path.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  }  \n}"229          },230          "responses" : {231            "default" : {232              "statusCode" : "200",233              "responseParameters" : {234                "method.response.header.Content-Type" : "'text/html'"235              },236              "responseTemplates" : {237                "text/html" : "$input.path('$')"238              }239            }240          },241          "type" : "aws"242        }243      },244      "post" : {245        "consumes" : [ "application/json" ],246        "produces" : [ "text/html" ],247        "responses" : {248          "200" : {249            "description" : "200 response",250            "headers" : {251              "Content-Type" : {252                "type" : "string"253              }254            }255          }256        },257        "x-amazon-apigateway-integration" : {258          "uri" : "@replace_lambda_function_url",259          "passthroughBehavior" : "when_no_templates",260          "httpMethod" : "POST",261          "requestTemplates" : {262            "application/json" : "{\n  \"method\": \"$context.httpMethod\",\n  \"body\" : $input.json('$'),\n  \"headers\": {\n    #foreach($param in $input.params().header.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"queryParams\": {\n    #foreach($param in $input.params().querystring.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().querystring.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"pathParams\": {\n    #foreach($param in $input.params().path.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  }  \n}"263          },264          "responses" : {265            "default" : {266              "statusCode" : "200",267              "responseParameters" : {268                "method.response.header.Content-Type" : "'text/html'"269              },270              "responseTemplates" : {271                "text/html" : "$input.path('$')"272              }273            }274          },275          "type" : "aws"276        }277      }278    }279  }280}281api_conf_json = {282  "swagger" : "2.0",283  "info" : {284    #"version" : "2016-11-01T05:02:15Z",285    "title" : "<replace>"286  },287  "basePath" : "/prod",288  "schemes" : [ "https" ],289  "paths" : {290    "/" : {291      "get" : {292        "consumes" : [ "application/json" ],293        "produces" : [ "application/json" ],294        "responses" : {295          "200" : {296            "description" : "200 response",297            "schema" : {298              "$ref" : "#/definitions/Empty"299            }300          }301        },302        "x-amazon-apigateway-integration" : {303          "uri" : "@replace_lambda_function_url",304          "passthroughBehavior" : "when_no_templates",305          "httpMethod" : "POST",306          "requestTemplates" : {307            "application/json" : "{\n  \"method\": \"$context.httpMethod\",\n  \"body\" : $input.json('$'),\n  \"headers\": {\n    #foreach($param in $input.params().header.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"queryParams\": {\n    #foreach($param in $input.params().querystring.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().querystring.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"pathParams\": {\n    #foreach($param in $input.params().path.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  }  \n}"308          },309          "responses" : {310            "default" : {311              "statusCode" : "200"312            }313          },314          "type" : "aws"315        }316      },317      "post" : {318        "consumes" : [ "application/json" ],319        "produces" : [ "application/json" ],320        "responses" : {321          "200" : {322            "description" : "200 response",323            "schema" : {324              "$ref" : "#/definitions/Empty"325            }326          }327        },328        "x-amazon-apigateway-integration" : {329          "uri" : "@replace_lambda_function_url",330          "passthroughBehavior" : "when_no_templates",331          "httpMethod" : "POST",332          "requestTemplates" : {333            "application/json" : "{\n  \"method\": \"$context.httpMethod\",\n  \"body\" : $input.json('$'),\n  \"headers\": {\n    #foreach($param in $input.params().header.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"queryParams\": {\n    #foreach($param in $input.params().querystring.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().querystring.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  },\n  \"pathParams\": {\n    #foreach($param in $input.params().path.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\n\n    #end\n  }  \n}"334          },335          "responses" : {336            "default" : {337              "statusCode" : "200"338            }339          },340          "type" : "aws"341        }342      }343    }344  },345  "definitions" : {346    "Empty" : {347      "type" : "object",348      "title" : "Empty Schema"349    }350  }351}352plain_api_conf = {353  "swagger" : "2.0",354  "info" : {355    "version" : "2016-11-01T04:22:35Z",356    "title" : "StoreAPI"357  },358  "basePath" : "/prod",359  "schemes" : [ "https" ],360  "paths" : {361    "/" : {362      "get" : {363        "produces" : [ "application/json" ],364        "responses" : {365          "200" : {366            "description" : "200 response",367            "schema" : {368              "$ref" : "#/definitions/Empty"369            }370          }371        },372        "x-amazon-apigateway-integration" : {373          "uri" : "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:004070725733:function:syncstore/invocations",374          "passthroughBehavior" : "when_no_match",375          "httpMethod" : "POST",376          "responses" : {377            "default" : {378              "statusCode" : "200"379            }380          },381          "type" : "aws"382        }383      }384    }385  },386  "definitions" : {387    "Empty" : {388      "type" : "object",389      "title" : "Empty Schema"390    }391  }392}393'''394mapping_template = {395  "method": "$context.httpMethod",396  "body" : $input.json('$'),397  "headers": {398    #foreach($param in $input.params().header.keySet())399    "$param": "$util.escapeJavaScript($input.params().header.get($param))" #if($foreach.hasNext),#end400    #end401  },402  "queryParams": {403    #foreach($param in $input.params().querystring.keySet())404    "$param": "$util.escapeJavaScript($input.params().querystring.get($param))" #if($foreach.hasNext),#end405    #end406  },407  "pathParams": {408    #foreach($param in $input.params().path.keySet())409    "$param": "$util.escapeJavaScript($input.params().path.get($param))" #if($foreach.hasNext),#end410    #end411  }412}413'''414if __name__ == '__main__':...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
