简单的python包,用于公司根据到公司办公室的距离,从包含json编码的客户坐标的数据文件中生成来宾列表。
guest_list的Python项目详细描述
简介
简单的python包,用于公司根据到公司办公室的距离,从包含json编码的客户坐标的数据文件中生成来宾列表。
示例数据文件在“customers.json”中给出
默认距离为100公里,默认办公地点为:
{"latitude": 53.3381985, 'longitude': -6.2592576}
要求
Python3
点
安装
pip install guest_list
用法
importguest_list# 'customers.json' must be stored in the same directory as your python scriptguests=guest_list.create("customers.json")forguestinguests:print("{}: {}".format(guest['user_id'],guest['name']))< >办公室位置和最大距离可以作为参数传递。
importguest_listoffice_coordinates={'latitude':53.378356,'longitude':-6.588503}max_distance_km=60.0guests=guest_list.create("customers.json",office_coordinates=office_coordinates,max_distance_km=max_distance_km)forguestinguests:print("{}: {}".format(guest['user_id'],guest['name']))
测试
运行测试:
git clone https://github.com/kujosHeist/guest_list.git cd guest_list python setup.py test