Skip to content

Latest commit

 

History

History
27 lines (26 loc) · 1007 Bytes

README.md

File metadata and controls

27 lines (26 loc) · 1007 Bytes

Minitracker

import requests
import json

Добавляем новую машину с начальными координатами (1, 1), получаем её id:

print(requests.post('http://localhost:8765/', data=json.dumps({'lat': 1, 'long': 1})).text)

Вывод списка всех машин:

print(requests.get('http://localhost:8765/').text)

Выводим последние координаты у машины с id = 1:

print(requests.get('http://localhost:8765/1').text)

Меняем координаты у машины с id = 1 на (22, 22):

print(requests.put('http://localhost:8765/1', data=json.dumps({'lat': 22, 'long': 22})).text)

Вывод ближайших 3 машин к точке (11, 11):

print(requests.post('http://localhost:8765/nearest/', data=json.dumps({'count': 3, 'lat': 11, 'long': 11})).text)
print(requests.get('http://localhost:8765/nearest/?count=3,lat=11,long=11').text)