Name | nsdotpy JSON |
Version |
2.3.0
JSON |
| download |
home_page | https://github.com/sw33ze/NSDotPy |
Summary | A wrapper around httpx that abstracts away interacting with the HTML nationstates.net site. Focused on legality, correctness, and ease of use. |
upload_time | 2024-02-22 22:59:55 |
maintainer | |
docs_url | None |
author | audrey |
requires_python | >=3.10,<3.13 |
license | AGPL-3.0-or-later |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# NSDotPy
A Python wrapper around httpx for legally interacting with the HTML NationStates site, as well as a barebones API client. Built for legality first and foremost, as well as ease of use.
## Installation
`pip install nsdotpy`
## Simple Example
```python
from nsdotpy.session import NSSession
session = NSSession("NSDotPy Example", "1.0.0", "Script Author's nation", "Script User's nation")
if session.login("User Nation", "Password"): # logs in and checks if login was successful
session.move_to_region("Lily") # only moves if you successfully logged in
# an API client is also available, here's a simple example
data = session.api_request("world", shard="nations")
# it returns a benedict object (https://github.com/fabiocaccamo/python-benedict), which is a dict with some extra features
# you can access the data like a normal dict
nations = data["nations"].split(",")
# or you can use a keyattribute (my personal favorite)
nations = data.nations.split(",")
```
## TODO:
- ~~Region Admin Controls~~
- Dossier and reports handling
- More fleshed out API Client
- ~~Cards support~~ Shoutouts to 9003
- ~~Migrate automatic docs generation, code formatting, and PyPI uploading to GitHub Actions for better CI~~
## Docs
https://audreyreal.github.io/NSDotPy/nsdotpy/session.html#NSSession
## Generating Docs
1. [Ensure poetry is installed](https://python-poetry.org/docs/#installation), or your system's package manager if applicable.
2. Run `poetry install` in the root directory of the project to install dependencies if you haven't already.
3. Run `poetry run pdoc nsdotpy/session.py -d=google -o=docs/` to generate the docs
## Publishing to PyPi (for maintainers)
1. [Ensure poetry is installed](https://python-poetry.org/docs/#installation), or your system's package manager if applicable.
2. Run `poetry install` in the root directory of the project to install dependencies if you haven't already.
3. Run `poetry build` to build the package. Ensure the version number in `pyproject.toml` is correct against the version number in `session.py`.
4. Run `poetry publish` to publish the package to PyPi. You will need to have a PyPi account have supplied your API key to poetry.
## Contributing
Pull requests are welcome. Ensure all code is formatted with `black`, that functions are type annotated (type annotating function variables not necessary), and docstrings are present using the Google style. If you use VSCode, [you can use this extension for easy docstring generation.](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring)
## License
[AGPL3.0-or-later](https://choosealicense.com/licenses/agpl-3.0/). Any project that uses this library must be licensed under AGPL3.0-or-later as well. If being used in a web application, the source code must be prominently made available to users.
Raw data
{
"_id": null,
"home_page": "https://github.com/sw33ze/NSDotPy",
"name": "nsdotpy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<3.13",
"maintainer_email": "",
"keywords": "",
"author": "audrey",
"author_email": "audreyreal@proton.me",
"download_url": "https://files.pythonhosted.org/packages/dd/4a/83e176a01b575d9d28cdefbbcc5f517a2bb988bd0a217106b7284a7f8049/nsdotpy-2.3.0.tar.gz",
"platform": null,
"description": "# NSDotPy\n\nA Python wrapper around httpx for legally interacting with the HTML NationStates site, as well as a barebones API client. Built for legality first and foremost, as well as ease of use.\n\n## Installation\n\n`pip install nsdotpy`\n\n## Simple Example\n\n```python\n\nfrom nsdotpy.session import NSSession\nsession = NSSession(\"NSDotPy Example\", \"1.0.0\", \"Script Author's nation\", \"Script User's nation\")\n\nif session.login(\"User Nation\", \"Password\"): # logs in and checks if login was successful\n session.move_to_region(\"Lily\") # only moves if you successfully logged in\n\n# an API client is also available, here's a simple example\ndata = session.api_request(\"world\", shard=\"nations\")\n# it returns a benedict object (https://github.com/fabiocaccamo/python-benedict), which is a dict with some extra features\n# you can access the data like a normal dict\nnations = data[\"nations\"].split(\",\")\n# or you can use a keyattribute (my personal favorite)\nnations = data.nations.split(\",\")\n```\n\n## TODO:\n\n- ~~Region Admin Controls~~\n- Dossier and reports handling\n- More fleshed out API Client\n- ~~Cards support~~ Shoutouts to 9003\n- ~~Migrate automatic docs generation, code formatting, and PyPI uploading to GitHub Actions for better CI~~\n\n## Docs\n\nhttps://audreyreal.github.io/NSDotPy/nsdotpy/session.html#NSSession\n\n## Generating Docs\n\n1. [Ensure poetry is installed](https://python-poetry.org/docs/#installation), or your system's package manager if applicable.\n2. Run `poetry install` in the root directory of the project to install dependencies if you haven't already.\n3. Run `poetry run pdoc nsdotpy/session.py -d=google -o=docs/` to generate the docs\n\n## Publishing to PyPi (for maintainers)\n\n1. [Ensure poetry is installed](https://python-poetry.org/docs/#installation), or your system's package manager if applicable.\n2. Run `poetry install` in the root directory of the project to install dependencies if you haven't already.\n3. Run `poetry build` to build the package. Ensure the version number in `pyproject.toml` is correct against the version number in `session.py`.\n4. Run `poetry publish` to publish the package to PyPi. You will need to have a PyPi account have supplied your API key to poetry.\n\n## Contributing\n\nPull requests are welcome. Ensure all code is formatted with `black`, that functions are type annotated (type annotating function variables not necessary), and docstrings are present using the Google style. If you use VSCode, [you can use this extension for easy docstring generation.](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring)\n\n## License\n\n[AGPL3.0-or-later](https://choosealicense.com/licenses/agpl-3.0/). Any project that uses this library must be licensed under AGPL3.0-or-later as well. If being used in a web application, the source code must be prominently made available to users.\n",
"bugtrack_url": null,
"license": "AGPL-3.0-or-later",
"summary": "A wrapper around httpx that abstracts away interacting with the HTML nationstates.net site. Focused on legality, correctness, and ease of use.",
"version": "2.3.0",
"project_urls": {
"Homepage": "https://github.com/sw33ze/NSDotPy",
"Repository": "https://github.com/sw33ze/NSDotPy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "73111f732c621b488d2e36e515dbb7db81471e9ab952a7428a34bfb5cf47d2d5",
"md5": "b880710108319e75aa2cca84539913c8",
"sha256": "4908c13bbf77d911c851b7a7346e987f2e7ee0c24afd55c2150e4409a4f08278"
},
"downloads": -1,
"filename": "nsdotpy-2.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b880710108319e75aa2cca84539913c8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<3.13",
"size": 29396,
"upload_time": "2024-02-22T22:59:53",
"upload_time_iso_8601": "2024-02-22T22:59:53.619501Z",
"url": "https://files.pythonhosted.org/packages/73/11/1f732c621b488d2e36e515dbb7db81471e9ab952a7428a34bfb5cf47d2d5/nsdotpy-2.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dd4a83e176a01b575d9d28cdefbbcc5f517a2bb988bd0a217106b7284a7f8049",
"md5": "fab41727cf5c7f80bd869cf0057ea09c",
"sha256": "8132dc9e66b13f500c8960fac162702f8cb896a9614d67d6d5c36d04562eaee7"
},
"downloads": -1,
"filename": "nsdotpy-2.3.0.tar.gz",
"has_sig": false,
"md5_digest": "fab41727cf5c7f80bd869cf0057ea09c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<3.13",
"size": 28934,
"upload_time": "2024-02-22T22:59:55",
"upload_time_iso_8601": "2024-02-22T22:59:55.467207Z",
"url": "https://files.pythonhosted.org/packages/dd/4a/83e176a01b575d9d28cdefbbcc5f517a2bb988bd0a217106b7284a7f8049/nsdotpy-2.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-22 22:59:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sw33ze",
"github_project": "NSDotPy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nsdotpy"
}