A Python wrapper for the NationStates api.
Works with a rate limit so as not to exceed NationState's API's rate limit.
GitHub Link
The package is available on PyPi! simply write:
pip install NaStyAPI
Link to full documentation (extremely outdated)
The NationStates 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
I take no responsibility for mistakes and errors that are caused by the use of this software. This is still in development and should not be used to handle sensitive or important information.
NationStates requires ("must") api users to specify a User-Agent. The default User-Agent is "A NaStyAPI User. Contact [email protected] for issues.", and NationStates requires that the user agent will be "something informative, such as the URL of your site or your e-mail address. It can be whatever you want, so long as it allows us to contact you if something goes wrong with your script."
from NaStyAPI import APICall
APICall.set_user_agent("Your Email")
from NaStyAPI import Nation
your_nation = Nation.Nation("NATION_NAME")
your_nation.log_password("YOUR_PASSWORD")
from NaStyAPI import Nation
your_nation = Nation.Nation("nation_name")
your_nation.log_password("YOUR_PASSWORD") # If shard is private, else not needed
your_nation.shard
from NaStyAPI import Nation
your_nation = Nation.Nation("nation_name")
your_nation.get_shards(["shards"])
from NaStyAPI import Nation
your_nation = Nation.Nation("nation_name")
your_nation.log_password("password")
new_dispatch = your_nation.add_dispatch("title", "text", "category", "sub_category")
This is a list of the features I am currently working on that should be ready quite soon.
- Finding bugs.
- Handling edge cases.
- Adding descriptions and updating docs.
Thank you for looking at this! If you want to contribute, feel free to update the docs in the /docs/ folder. I am still adding features, so I didn't have the time to do it myself.
My in-game nation is "Khiralia", if you want to show support feel free to telegram a nice message :)