# url = f"https://carapi.app/api/vin/{vin}?verbose=no&all_trims=no" # headers = { # "Authorization": f"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjYXJhcGkuYXBwIiwic3ViIjoiYjU1OGYzMDMtODI0Ni00NjgzLTkwYTQtZmYwMGQxYWNmNGU3IiwiYXVkIjoiYjU1OGYzMDMtODI0Ni00NjgzLTkwYTQtZmYwMGQxYWNmNGU3IiwiZXhwIjoxNzI0MzgyODMzLCJpYXQiOjE3MjM3NzgwMzMsImp0aSI6IjA3ZDUzM2Y5LWRmNzEtNDM1My1hMTBhLTNiYmQ2MDljNWM0YiIsInVzZXIiOnsic3Vic2NyaWJlZCI6dHJ1ZSwic3Vic2NyaXB0aW9uIjoic3RhcnRlciIsInJhdGVfbGltaXRfdHlwZSI6ImhhcmQiLCJhZGRvbnMiOnsiYW50aXF1ZV92ZWhpY2xlcyI6ZmFsc2UsImRhdGFfZmVlZCI6ZmFsc2V9fX0.KnaH-dOGcmJAF3WqzrZ_c_eFtkSjPVEjR15G7KFxi2s" # } # # try: # response = requests.get(url, headers=headers) # response.raise_for_status() # Raises an HTTPError for bad responses (4XX, 5XX) # # response = response.json() # print(response) # # except requests.exceptions.HTTPError as http_err: # print(f"HTTP error occurred: {http_err}") # except requests.exceptions.RequestException as err: # print(f"Error occurred: {err}") # except Exception as e: # print(f"An error occurred: {e}") # class TokenAuthenticationMiddleware(MiddlewareMixin): # # def process_request(self, request, *args, **kwargs): # # exempt_paths = ['/login/', '/signup/', '/'] # if request.path in exempt_paths: # return None # # token_key = request.META.get('HTTP_AUTHORIZATION') # if token_key: # token_key = token_key.split(' ')[1] if ' ' in token_key else token_key # try: # token = Token.objects.get(key=token_key) # request.user = token.user # except Token.DoesNotExist: # return HttpResponseForbidden("Invalid token") # # if not request.user.is_authenticated: # return HttpResponseForbidden("You are not authorized to view this page") # # return None # def vin_decode(vin): # apiKey = "67b751455994" # secretKey = "2ca9c09960" # apiPrefix = "https://api.vindecoder.eu/3.2" # id = "decode" # # controlSum = hashlib.sha1((vin.upper() + "|" + id + "|" + apiKey + "|" + secretKey).encode('utf-8')).hexdigest()[ # :10] # url = apiPrefix + "/" + apiKey + "/" + controlSum + "/decode/" + vin.upper() + ".json" # print(url) # json_data = requests.get(url).json() # print(json_data) # return json_data { "year": 2007, "make": "CHEVROLET", "model": "TrailBlazer", "trim": "1/2 Ton", "specs": { "active_safety_system_note": null, "adaptive_cruise_control_acc": null, "adaptive_driving_beam_adb": null, "anti_lock_braking_system_abs": null, "auto_reverse_system_for_windows_and_sunroofs": null, "automatic_crash_notification_acn_advanced_automatic_crash_notification_aacn": null, "automatic_pedestrian_alerting_sound_for_hybrid_and_ev_only": null, "axle_configuration": null, "axles": null, "backup_camera": null, "base_price": null, "battery_current_amps_from": null, "battery_current_amps_to": null, "battery_energy_kwh_from": null, "battery_energy_kwh_to": null, "battery_type": null, "battery_voltage_volts_from": null, "battery_voltage_volts_to": null, "bed_length_inches": null, "bed_type": null, "blind_spot_intervention_bsi": null, "blind_spot_warning_bsw": null, "body_class": "Sport Utility Vehicle (SUV)/Multi-Purpose Vehicle (MPV)", "brake_system_description": null, "brake_system_type": "Hydraulic", "bus_floor_configuration_type": "Not Applicable", "bus_length_feet": null, "bus_type": "Not Applicable", "cab_type": null, "charger_level": null, "charger_power_kw": null, "cooling_type": "Water", "crash_imminent_braking_cib": null, "curb_weight_pounds": null, "curtain_air_bag_locations": null, "custom_motorcycle_type": "Not Applicable", "daytime_running_light_drl": null, "destination_market": null, "displacement_cc": "4200.0", "displacement_ci": "256.29972519787", "displacement_l": "4.2", "doors": "4", "drive_type": "4x2", "dynamic_brake_support_dbs": null, "electrification_level": null, "electronic_stability_control_esc": null, "engine_brake_hp_from": null, "engine_brake_hp_to": null, "engine_configuration": "In-Line", "engine_manufacturer": "GM", "engine_model": "LL8", "engine_number_of_cylinders": "6", "engine_power_kw": null, "engine_stroke_cycles": null, "entertainment_system": null, "ev_drive_unit": null, "event_data_recorder_edr": null, "forward_collision_warning_fcw": null, "front_air_bag_locations": null, "fuel_delivery_fuel_injection_type": "Multipoint Fuel Injection (MPFI)", "fuel_type_primary": "Gasoline", "fuel_type_secondary": null, "gross_combination_weight_rating_from": null, "gross_combination_weight_rating_to": null, "gross_vehicle_weight_rating_from": "Class 1D: 5,001 - 6,000 lb (2,268 - 2,722 kg)", "gross_vehicle_weight_rating_to": null, "headlamp_light_source": null, "keyless_ignition": null, "knee_air_bag_locations": null, "lane_centering_assistance": null, "lane_departure_warning_ldw": null, "lane_keeping_assistance_lka": null, "manufacturer_name": "GENERAL MOTORS LLC", "motorcycle_chassis_type": "Not Applicable", "motorcycle_suspension_type": "Not Applicable", "ncsa_body_type": "Compact Utility (Utility Vehicle Categories \"Small\" and \"Midsize\")", "ncsa_make": "Chevrolet", "ncsa_model": "TrailBlazer (2003 on; for 2002 model, see 401)", "ncsa_note": null, "non_land_use": null, "note": null, "number_of_battery_cells_per_module": null, "number_of_battery_modules_per_pack": null, "number_of_battery_packs_per_vehicle": null, "number_of_seat_rows": null, "number_of_seats": null, "number_of_wheels": null, "other_battery_info": null, "other_bus_info": null, "other_engine_info": "MFI, DOHC, Aluminium", "other_motorcycle_info": null, "other_restraint_system_info": null, "other_trailer_info": null, "parking_assist": null, "pedestrian_automatic_emergency_braking_paeb": null, "plant_city": "MORAINE", "plant_company_name": "GM Truck Group", "plant_country": "UNITED STATES (USA)", "plant_state": "OHIO", "possible_values": "", "pretensioner": null, "rear_automatic_emergency_braking": null, "rear_cross_traffic_alert": null, "sae_automation_level_from": null, "sae_automation_level_to": null, "seat_belt_type": null, "seat_cushion_air_bag_locations": null, "semiautomatic_headlamp_beam_switching": null, "series": "1/2 Ton", "series2": null, "side_air_bag_locations": null, "steering_location": null, "suggested_vin": "", "tire_pressure_monitoring_system_tpms_type": null, "top_speed_mph": null, "track_width_inches": null, "traction_control": null, "trailer_body_type": "Not Applicable", "trailer_length_feet": null, "trailer_type_connection": "Not Applicable", "transmission_speeds": null, "transmission_style": null, "trim": null, "trim2": null, "turbo": null, "valve_train_design": "Dual Overhead Cam (DOHC)", "vehicle_descriptor": "1GNDS13S*72", "vehicle_type": "MULTIPURPOSE PASSENGER VEHICLE (MPV)", "wheel_base_inches_from": null, "wheel_base_inches_to": null, "wheel_base_type": null, "wheel_size_front_inches": null, "wheel_size_rear_inches": null, "windows": null }, "trims": [ { "id": 40805, "make_model_id": 33, "year": 2007, "name": "LS", "description": "LS 4dr SUV (4.2L 6cyl 4A)", "msrp": 25045, "invoice": 23417, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40805, "make_model_trim_id": 40805, "fuel_tank_capacity": "22.0", "combined_mpg": 16, "epa_city_mpg": 14, "epa_highway_mpg": 20, "range_city": 308, "range_highway": 440, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40805, "make_model_trim_id": 40805, "engine_type": "gas", "fuel_type": "regular unleaded", "cylinders": "I6", "size": "4.2", "horsepower_hp": 291, "horsepower_rpm": 6000, "torque_ft_lbs": 277, "torque_rpm": 4800, "valves": 24, "valve_timing": "Variable", "cam_type": "Double overhead cam (DOHC)", "drive_type": "rear wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40805, "make_model_trim_id": 40805, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": "72.5", "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4356, "gross_weight": 5550, "max_payload": 1194, "max_towing_capacity": 6800 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } }, { "id": 40806, "make_model_id": 33, "year": 2007, "name": "LS", "description": "LS 4dr SUV 4WD (4.2L 6cyl 4A)", "msrp": 27340, "invoice": 25563, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40806, "make_model_trim_id": 40806, "fuel_tank_capacity": "22.0", "combined_mpg": 16, "epa_city_mpg": 14, "epa_highway_mpg": 20, "range_city": 308, "range_highway": 440, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40806, "make_model_trim_id": 40806, "engine_type": "gas", "fuel_type": "regular unleaded", "cylinders": "I6", "size": "4.2", "horsepower_hp": 291, "horsepower_rpm": 6000, "torque_ft_lbs": 277, "torque_rpm": 4800, "valves": 24, "valve_timing": "Variable", "cam_type": "Double overhead cam (DOHC)", "drive_type": "four wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40806, "make_model_trim_id": 40806, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": "72.5", "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4523, "gross_weight": 5750, "max_payload": 1227, "max_towing_capacity": 6600 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } }, { "id": 40807, "make_model_id": 33, "year": 2007, "name": "LT", "description": "LT 4dr SUV (4.2L 6cyl 4A)", "msrp": 27970, "invoice": 26152, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40807, "make_model_trim_id": 40807, "fuel_tank_capacity": "22.0", "combined_mpg": 16, "epa_city_mpg": 14, "epa_highway_mpg": 20, "range_city": 308, "range_highway": 440, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40807, "make_model_trim_id": 40807, "engine_type": "gas", "fuel_type": "regular unleaded", "cylinders": "I6", "size": "4.2", "horsepower_hp": 291, "horsepower_rpm": 6000, "torque_ft_lbs": 277, "torque_rpm": 4800, "valves": 24, "valve_timing": "Variable", "cam_type": "Double overhead cam (DOHC)", "drive_type": "rear wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40807, "make_model_trim_id": 40807, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": null, "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4356, "gross_weight": 5550, "max_payload": 1194, "max_towing_capacity": 6800 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } }, { "id": 40808, "make_model_id": 33, "year": 2007, "name": "LT", "description": "LT 4dr SUV 4WD (4.2L 6cyl 4A)", "msrp": 30210, "invoice": 28246, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40808, "make_model_trim_id": 40808, "fuel_tank_capacity": "22.0", "combined_mpg": 16, "epa_city_mpg": 14, "epa_highway_mpg": 20, "range_city": 308, "range_highway": 440, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40808, "make_model_trim_id": 40808, "engine_type": "gas", "fuel_type": "regular unleaded", "cylinders": "I6", "size": "4.2", "horsepower_hp": 291, "horsepower_rpm": 6000, "torque_ft_lbs": 277, "torque_rpm": 4800, "valves": 24, "valve_timing": "Variable", "cam_type": "Double overhead cam (DOHC)", "drive_type": "four wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40808, "make_model_trim_id": 40808, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": null, "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4523, "gross_weight": 5750, "max_payload": 1227, "max_towing_capacity": 6600 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } }, { "id": 40809, "make_model_id": 33, "year": 2007, "name": "SS", "description": "SS 4dr SUV (6.0L 8cyl 4A)", "msrp": 31320, "invoice": 29284, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40809, "make_model_trim_id": 40809, "fuel_tank_capacity": "22.0", "combined_mpg": 15, "epa_city_mpg": 13, "epa_highway_mpg": 17, "range_city": 286, "range_highway": 374, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40809, "make_model_trim_id": 40809, "engine_type": "gas", "fuel_type": "premium unleaded (required)", "cylinders": "V8", "size": "6.0", "horsepower_hp": 395, "horsepower_rpm": 5400, "torque_ft_lbs": 400, "torque_rpm": 4400, "valves": 16, "valve_timing": null, "cam_type": "Overhead valves (OHV)", "drive_type": "rear wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40809, "make_model_trim_id": 40809, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": "67.8", "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4496, "gross_weight": 6001, "max_payload": 1505, "max_towing_capacity": 6800 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } }, { "id": 40810, "make_model_id": 33, "year": 2007, "name": "SS", "description": "SS 4dr SUV AWD (6.0L 8cyl 4A)", "msrp": 33620, "invoice": 31435, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40810, "make_model_trim_id": 40810, "fuel_tank_capacity": "22.0", "combined_mpg": 14, "epa_city_mpg": 12, "epa_highway_mpg": 16, "range_city": 264, "range_highway": 352, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40810, "make_model_trim_id": 40810, "engine_type": "gas", "fuel_type": "premium unleaded (required)", "cylinders": "V8", "size": "6.0", "horsepower_hp": 395, "horsepower_rpm": 5400, "torque_ft_lbs": 400, "torque_rpm": 4400, "valves": 16, "valve_timing": null, "cam_type": "Overhead valves (OHV)", "drive_type": "all wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40810, "make_model_trim_id": 40810, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": "67.8", "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4663, "gross_weight": 6001, "max_payload": 1338, "max_towing_capacity": 6600 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } }, { "id": 40812, "make_model_id": 33, "year": 2007, "name": "SS", "description": "SS 4dr SUV AWD w/3SS (6.0L 8cyl 4A)", "msrp": 37125, "invoice": 34712, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40812, "make_model_trim_id": 40812, "fuel_tank_capacity": "22.0", "combined_mpg": 14, "epa_city_mpg": 12, "epa_highway_mpg": 16, "range_city": 264, "range_highway": 352, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40812, "make_model_trim_id": 40812, "engine_type": "gas", "fuel_type": "premium unleaded (required)", "cylinders": "V8", "size": "6.0", "horsepower_hp": 395, "horsepower_rpm": 5400, "torque_ft_lbs": 400, "torque_rpm": 4400, "valves": 16, "valve_timing": null, "cam_type": "Overhead valves (OHV)", "drive_type": "all wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40812, "make_model_trim_id": 40812, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": "67.8", "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4663, "gross_weight": 6001, "max_payload": 1338, "max_towing_capacity": 6600 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } }, { "id": 40811, "make_model_id": 33, "year": 2007, "name": "SS", "description": "SS 4dr SUV w/3SS (6.0L 8cyl 4A)", "msrp": 34885, "invoice": 32617, "created": "2023-06-29T21:13:16-04:00", "modified": "2023-06-29T21:13:16-04:00", "make_model_trim_mileage": { "id": 40811, "make_model_trim_id": 40811, "fuel_tank_capacity": "22.0", "combined_mpg": 15, "epa_city_mpg": 13, "epa_highway_mpg": 17, "range_city": 286, "range_highway": 374, "battery_capacity_electric": null, "epa_time_to_charge_hr_240v_electric": null, "epa_kwh_100_mi_electric": null, "range_electric": null, "epa_highway_mpg_electric": null, "epa_city_mpg_electric": null, "epa_combined_mpg_electric": null }, "make_model_trim_engine": { "id": 40811, "make_model_trim_id": 40811, "engine_type": "gas", "fuel_type": "premium unleaded (required)", "cylinders": "V8", "size": "6.0", "horsepower_hp": 395, "horsepower_rpm": 5400, "torque_ft_lbs": 400, "torque_rpm": 4400, "valves": 16, "valve_timing": null, "cam_type": "Overhead valves (OHV)", "drive_type": "rear wheel drive", "transmission": "4-speed automatic" }, "make_model_trim_body": { "id": 40811, "make_model_trim_id": 40811, "type": "SUV", "doors": 5, "length": "191.8", "width": "74.7", "seats": 5, "height": "67.8", "wheel_base": "113.0", "front_track": "62.7", "rear_track": "62.0", "ground_clearance": "7.8", "cargo_capacity": "43.7", "max_cargo_capacity": "80.1", "curb_weight": 4496, "gross_weight": 6001, "max_payload": 1505, "max_towing_capacity": 6800 }, "make_model": { "id": 33, "make_id": 6, "name": "TrailBlazer", "make": { "id": 6, "name": "Chevrolet" } } } ] }