项目作者: jdtech3

项目描述 :
Politics & War API wrapper for Python
高级语言: Python
项目地址: git://github.com/jdtech3/PW4py.git
创建时间: 2019-02-11T01:25:27Z
项目社区:https://github.com/jdtech3/PW4py

开源协议:MIT License

下载


PW4py: Politics & War API wrapper for Python


- This project is abandoned, though you are welcome to fork it and continue. -


Currently Implemented API Endpoints

  • Unauthenticated APIs:

    • Nation API
    • Alliance API
    • work still in progress
  • Authenticated APIs:

    • none, work still in progress

Features

  • Easy to use
  • Object oriented (take this with a grain of salt, it’s my first OOP project xD)
  • No need worry about Alex’s inability to use correct typing 🙄
  • Built-in cache for better performance in non-time-critical APIs in progress
  • Supports both requests and aiohttp backends in progress

Installation

PW4py is now on PyPI, so you can just install it by doing:

  1. pip install pw4py

Usage

  1. Load it:

    1. import pw4py
    2. # default
    3. pw4py.init(key = "abcdef12345")
    4. # use the test server
    5. pw4py.load(test_server = True, key = "abcdef12345")
  2. Init an object of the API you want to use:

    1. from pw4py import Nation # so you don't have to type pw4py.Nation() every time
    2. nation = Nation(id)
  3. Use it!
    1. name = str(nation)
    2. cityids = nation.cityids
    3. color = nation.get("color")
    4. # etc...

Issues or suggestions

Feel free to make a new issue here if you find any bugs, encounter any problems, or have a feature suggestion.
If you know how to fix it or how to implement a new feature, please do! Fork the repo, and submit a pull request :)