A Python wrapper for the NationStates API
Project description
NaStyAPI - A NationState wrapper
!Note: This package is still highly in development and is really not recommended for public use yet!
A Python wrapper for the NationStates api.
Works with a rate limit so as not to exceed NationState's API's rate limit.
NaStyAPI only handles communication, it does not parse the result in any way!
GitHub Link
Table of Contensts:
Installation
The package is available on PyPi! simply write:
pip install NaStyAPI
Documentation
Link to full documentation (in progress)
General Use
The NationState API is divided into parts, and so is the wrapper. The parts are:
- Nation
- Region
- Telegrams
- TradingCards
- World
- WorldAssembly
To use a part, simply write:
from NaStyAPI import Part
Warning
The wrapper is usable already, as you can see by the examples below. That, however, does not mean it's recommended to use. The wrapper is largely undocumented and is not yet great at managing errors. You can use it, but it's not going to be to pleasant.
Examples
Get a public shard on a nation
from NaStyAPI import Nation
Nation.get_shards("NATION_NAME",["SHARDS"])
Log in to your nation
from NaStyAPI import Nation
your_nation = Nation.Nation("NATION_NAME")
your_nation.log_password("YOUR_PASSWORD")
Access to private shards
your_nation.get_shards("YOUR_PRIVATE_SHARDS")
Write a dispatch using the api
new_dispatch = your_nation.do_command("dispatch", additional_params={"dispatch": "add", "title": "YOUR POST TITLE", "text": "DISPATCH TEXT", "category": "CATEGORY_NUM", "subcategory": "SUBCATEGORY_NUM"})
How to contribute
Thank you for looking at this! There isn't all that much to do yet, so the best you can do to help is to use it!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.