用于osrm api的python客户端
osrm-p的Python项目详细描述
用于OSRM API
的python客户端运行测试套件
pythonsetup.pytest
需要
- 请求
- aiohttp
用法
使用请求
使用aiohttp
importosrmclient=osrm.Client(host='http://localhost:5000')response=client.route(coordinates=[[-74.0056,40.6197],[-74.0034,40.6333]],overview=osrm.overview.full)print(response)
importasyncioimportosrmloop=asyncio.get_event_loop()asyncdefrequest():client=osrm.AioHTTPClient(host='http://localhost:5000')response=awaitclient.route(coordinates=[[-74.0056,40.6197],[-74.0034,40.6333]],overview=osrm.overview.full)print(response)awaitclient.close()loop.run_until_complete(request())