blablacar客户端api

BlaBlaCar-A的Python项目详细描述


blablacar api客户端python库

PyPI version

轻松搜索旅行!

安装

适用于2.7.x和3.x python。

pip install blablacar-api

使用量

fromblablacarapiimportBlaBlaCarApi# initialize APIapi=BlaBlaCarApi(api_key="__your_api_key_here__")# fetch trips from London to Paristrips=api.trips(frm="London",to="Paris")# after fetching you have:# trips.trips# trips.top_trips# trips.pager# trips.facets# trips.savings# trips.distance# trips.duration# trips.recommended_price# iterate over the tripsfortripintrips.trips:print("%s: %s -> %s"%(trip.departure_date,trip.departure_place['address'],trip.arrival_place['address']))# fetch data for one trip using trip idsingle_trip=api.trip(trip.permanent_id)# pagingtrips.pager.has_next()# True or Falsetrips.pager.next()# returns 2 if the current page is 1trips.pager.has_previous()# True or Falsetrips.pager.previous()# returns False if the current page is 1, and it returns 1 if current page is 2

地区

api=BlaBlaCarApi(api_key="__your_blablacar_api_key_here__",locale="en_GB",currency="en_GB")

调试

如果要使用有关api调用的数据调试代码。

# initialize with debug=Trueapi=BlaBlaCarApi(api_key="...",debug=True)# after every API call the client library will automatically print all the data to standard outputapi.trips(...)# and you can always have all debug data in your codedebug_data=api.request.debug.show()

官方文件

有关详细信息,请访问官方文档:https://dev.blablacar.com/docs/versions/1.0

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
从类访问属性时发生java编译错误   性能更好的Java序列化替代方案   java EhCache Spring XML集成命名空间   java如何使用表达式在JSP中检索新生成的图像   Java neo4j,REST和内存   java如何在mouseListener中删除和创建对象?   java在Hibernate中使用预定义前缀填充Id列   java无法从Elastic Beanstalk连接到Amazon SimpleDB   多线程通过单击JavaSwing中的按钮创建具有新名称的类的新对象   java如何在Kotlin中实现Memento模式   Android系列。对java进行排序。lang.NullPointerException   方法中的java重载构造函数内部类