官方guild wars 2 json api的简单包装。

gw2apiwrapper的Python项目详细描述


GW2APIWRAPPER是一个Python库,旨在通过Python抽象出与官方激战2(GW2)API交互的开销和复杂性。

这个库的目的是使编写和阅读python应用程序和工具变得简单,只需对gw2 api本身了解很少。

这是通过抽象出常用的标准json->;字典映射方案并用oop风格(例如item.name)表示法替换它来实现的。

安装

只需使用pip/pipenv安装,您就可以开始了:

pip install gw2apiwrapper

示例

fromgw2apiwrapperimportAccountAPI,GlobalAPI# Get an account based object. Requires API Key.personal=AccountAPI("<APIKEY>")# Get a 'Global' api object. (Non-authed)workHorse=GlobalAPI()# This is iterable, as not only does it fill the personal.bank# attribute, it also returns that information allowing it to be# used in loops..even though we don't here.personal.getBank()# Should be self documenting, but demonstrates that the previous# getBank() call actually populated that object's 'bank' attribute.bankIDs=[slot['id']forslotinpersonal.bankifslotisnotNone]# GlobalAPI's getItem can take different types, all documented.itemObjects=workHorse.getItem(bankIDs)# Get the names of all items in bank.foriteminitemObjects:print(item.name)

注释

这个项目正在半主动开发中。这项工作已经打下了基础,而且大部分api都已被考虑在内。如果您需要的东西丢失了,并且您希望它被添加,请随时打开问题(或拉取请求!)在Github上。

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

推荐PyPI第三方库


热门话题
java通过Spring MVC web应用程序向客户端发送文本文件   java是否可以在运行时动态实例化DAO类?   调用VB。来自Java的net函数   java在Android中通过单击打开特定文件夹   java如何使用maven pom。xml标识非标准项目结构中的testng测试用例?   java为什么FOP在大文件上崩溃?   Architecture python+flask和spring boot+java   java Kafka工具根本没有启动Ubuntu 19.10   如何使用Eclipse运行Java USB API for Windows   java如何在Eclipse中查看J2EE预览服务器/容器的日志/控制台?   网页抓取是否可以使用Java crawler crawler4j暂停和恢复抓取?   java当我第二次按下按钮时,应用程序停止工作   带有偏移量和限制的java SQLite分页问题   java如何在OSX mavericks中将端口80转发到8080   java从泛型方法调用非泛型方法   java My代码未按预期工作。十进制输出不是它应该的样子   节点。java中的js加密(jasypt)和nodejs中的解密   java乘法表不工作数组索引超出范围   java将JDBC与Firebirdsql连接起来