Closed shivahari closed 4 months ago
Tested this using session against https://cars-app.qxf2.com/ by adding a new car and the changes look good.
>>> response = my_session.get(url='http://cars-app.qxf2.com/cars',auth=("qxf2","qxf2"))
>>> response.json()
{'cars_list': [{'brand': 'Maruti', 'car_type': 'hatchback', 'name': 'Swift', 'price_range': '3-5 lacs'}, {'brand': 'Hyundai', 'car_type': 'hatchback', 'name': 'Creta', 'price_range': '8-14 lacs'}, {'brand': 'Honda', 'car_type': 'sedan', 'name': 'City', 'price_range': '3-6 lacs'}, {'brand': 'Volkswagen', 'car_type': 'sedan', 'name': 'Vento', 'price_range': '7-10 lacs'}], 'successful': True}
>>>response = my_session.post(url='http://cars-app.qxf2.com/cars/add',json={'name':'figo','brand':'Ford','price_range':'2-3lacs','car_type':'hatchback'},auth=("qxf2","qxf2"))
>>> response = my_session.get(url='http://cars-app.qxf2.com/cars',auth=("qxf2","qxf2"))
>>> response.json()
{'cars_list': [{'brand': 'Maruti', 'car_type': 'hatchback', 'name': 'Swift', 'price_range': '3-5 lacs'}, {'brand': 'Hyundai', 'car_type': 'hatchback', 'name': 'Creta', 'price_range': '8-14 lacs'}, {'brand': 'Honda', 'car_type': 'sedan', 'name': 'City', 'price_range': '3-6 lacs'}, {'brand': 'Volkswagen', 'car_type': 'sedan', 'name': 'Vento', 'price_range': '7-10 lacs'}, {'brand': 'Ford', 'car_type': 'hatchback', 'name': 'figo', 'price_range': '2-3lacs'}], 'successful': True}```
Modifie the
systemd
service file to run the app on1
worker while hosting the app.