午餐机器人API的Python接口。

lunchbot-python的Python项目详细描述


午餐Python

一个Python包,用于与@Nero2k午餐机器人API交互,后者是一个提供Eatery Kista Nod餐厅每周午餐菜单的API。在

这个包将菜单属性完全解析为Python对象,非常容易使用。在

安装

安装通过以下方式完成:

pip install lunchbot-python

快速启动

有关更多代码示例的详细指南,请参阅official documentation。在

下面还有一个图像快速启动示例和一个简洁的代码示例,但也可以在上面链接的官方文档中找到。在

"""Websocket/API exampleThis example shows you the "standard" way of getting the weekmenu, which will return a parsed list of Day objects. The Day class is implemented with this APINOTE: Want to do this with less code?Check the compact example."""fromeatery_nodimportEateryNod#Import the librarymenu=EateryNod.Menu()#Create a menu objectmenu.initialize()#Initialize (this is only required when using WebSockets)print("Retrieving menu...")#Print out the statusweek_menu=menu.get_menu()#Get the menufordayinweek_menu:#Loop through all the days in the menumenu_items_str="\n".join(day.menu_items)#Format the menu items to a pretty string as they are returned as a listprint(day.day_name_sv)#Print out the day name (in Swedish)print(menu_items_str)#Print out the menu itemsprint("Day information:")#Print out a nice dividerprint("Date: "+str(day.day_date))#Print out the day dateprint("Dessert served?: "+str(day.dessert_served))#Print out if dessert is served (this will print either True or False)print("Pancakes served?: "+str(day.pancakes_served))#Print out if pancakes are served (this will print either True or False)print("Hamburgers served?: "+str(day.burgers_served))#Print out if hamburgers are served (this will print either True or False)print("---------------------------------------------------")#Print out a divider linelast_retrieved=menu.last_retrieved["json"]#Get when the menu was last retrievedprint("Menu retrieved: "+str(last_retrieved))#Print out when the menu was last retrieved.

变更日志

请参阅“Releases”选项卡和文档。在

更多文档

代码的所有函数、变量和属性都有文档记录。您可以在正式的库文档中找到它,该文档由GitBook提供,托管在https://lunchbot-python.albins.website。在

(尚未上载任何代码,只是已创建的初始存储库)

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

推荐PyPI第三方库


热门话题
java如何从IBM MQ的JMSException检测可恢复错误   java Lucene6。4.2:找不到类,尝试添加查询。   Java Pdf差异库   在Java中多线程处理我的线程   java将字符串传递给Uri。下载中的parse()   java在列表中查找原语位置   java JPA条件从另一个查询中选择   java中的强制转换和转换   java如何在没有上下文的情况下获取SOAP Web服务(Apache Axis 1.4)的调用客户端的IP地址   java Android IllegalBlockSizeException:解密中最后一个块未完成   java Jersey是否要自定义无效资源路径的错误处理?   如何将JavaCVS web项目转换为基于maven的web项目?   java如何检查通用列表是否与jUnit相等?   arraylist java。util。尝试使用迭代器时发生ConcurrentModificationException错误   使用springsecurity,jsp上的java${u csrf.token}始终为空   sql使用java从临时表中选择数据   spring验证中的java@Notnull和@Pattern无效   java如何使用jQuery将包含对象数组的对象数组传递给Spring MVC控制器?