Skip to content

Commit

Permalink
Revert "Added a random-traffic-generator for the Python Sample App"
Browse files Browse the repository at this point in the history
This reverts commit fd93b31.
  • Loading branch information
AsakerMohd committed Jan 29, 2024
1 parent 828976c commit bc27e6e
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
# SPDX-License-Identifier: Apache-2.0
import json
import os
import time

import requests
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed, HttpResponseNotFound
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed
from django.views.decorators.csrf import csrf_exempt
from dotenv import load_dotenv
from MainService.models import Vehicle
Expand Down Expand Up @@ -41,23 +40,14 @@ def vehicle(request):

def get_vehicle_by_id(request, vehicle_id):
if request.method == "GET":
throttle_time = request.GET.get("throttle")
if throttle_time:
print("going to throttle for " + throttle_time + " seconds")
time.sleep(int(throttle_time))

vehicle_objects = Vehicle.objects.filter(id=vehicle_id).values()
if not vehicle_objects:
return HttpResponseNotFound("Vehicle with id=" + str(vehicle_id) + " is not found")
return HttpResponse(vehicle_objects)
return HttpResponseNotAllowed("Only GET requests are allowed!")


def get_vehicle_image(request, vehicle_id):
if request.method == "GET":
vehicle_object = Vehicle.objects.filter(id=vehicle_id).first()
if not vehicle_object:
return HttpResponseNotFound("Vehicle with id=" + str(vehicle_id) + " is not found")
image_name = getattr(vehicle_object, "image_name")
return HttpResponse(requests.get(get_image_endpoint() + "/images/name/" + image_name, timeout=10))
return HttpResponseNotAllowed("Only GET requests are allowed!")

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

REGION=${1:-"us-east-1"}
REGION=${2:-"us-east-1"}

aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin ${REPOSITORY_PREFIX}

Expand Down

0 comments on commit bc27e6e

Please sign in to comment.