Skip to main content

A Python wrapper for the NationStates API

Project description

NaStyAPI - A NationState wrapper

PyPi status Documentation Status
!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.

Source Distribution

NaStyAPI-0.2.1.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

NaStyAPI-0.2.1-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page