awesomeNations


NameawesomeNations JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA simple python web scraping library for NationStates
upload_time2025-01-07 23:08:22
maintainerNone
docs_urlNone
authorOrly Neto
requires_pythonNone
licenseMIT License
keywords nationstates scrapper web scrapper nationstates scrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img src="https://i.imgur.com/yQ9gI82.png" />
</p>

<h1 align="center">AwesomeNations</h1>	

![Python](https://img.shields.io/badge/python-3.10%2B-blue)
![License](https://img.shields.io/badge/license-MIT-green)

**AwesomeNations** is a clumsy Python library for scraping data from [NationStates](https://www.nationstates.net), a browser-based nation simulation game created at 13 November 2002 by Max Barry- Oh wait, nobody cares about real life lore. Anyways, this library allows you to collect nation and region data, retrieve census statistics, and much gore- more.

You can install AwesomeNations using pip:

``` bash
pip install awesomeNations
```

Easy, quick and almost make me forget I spent months of my life to make this thing work!

---

## Nation Features: ദ്ദി(˵ •̀ ᴗ - ˵ ) ✧

You can get censuses from a nation doing this:

``` python
from awesomeNations import AwesomeNations as awn

nation = awn.Nation('testlandia')

AwesomeData = nation.get_census((0, 2, 4, 46, 88)) # Returns a generator object

for census in AwesomeData:
    print(census)
```

Output:

``` bash
{'title': 'Civil Rights', 'value': '65.50', 'bubbles': {'world_rank': '96,109th', 'region_rank': '12th'}}
{'title': 'Political Freedom', 'value': '70.86', 'bubbles': {'world_rank': '88,471st', 'region_rank': '13th'}}
{'title': 'Wealth Gaps', 'value': '1.41', 'bubbles': {'world_rank': '288,472nd', 'region_rank': '44th'}}
{'title': 'Defense Forces', 'value': '7,512.87', 'bubbles': {'world_rank': '26,476th', 'region_rank': '12th'}}      
{'title': 'Food Quality', 'value': '139.90', 'bubbles': {'world_rank': '13,306th', 'region_rank': '6th'}}
```

Nation overview:

``` python
from awesomeNations import AwesomeNations as awn
from pprint import pprint as pp

nation = awn.Nation('testlandia')

overview = nation.get_overview()
pp(overview)
```

Output:

``` bash
{'box': {'animal': '★★★ nautilus ★★★',
         'capital': 'Tést City',
         'currency': 'Kro-bro-ünze',
         'faith': 'Neo-Violetism',
         'leader': 'Violet',
         'population': '46.479 billion'},
 'bubbles': {'civil_rights': 'Very Good',
             'economy': 'Powerhouse',
             'influence': 'Eminence Grise',
             'political_freedom': 'Excellent',
             'region': 'Testregionia'},
 'description': {'economy': 'The powerhouse Testlandian economy, worth a '
                            'remarkable 3,173 trillion Kro-bro-ünzes a year, '
                            'is driven almost entirely by government activity. '
                            'The industrial sector is solely comprised of the '
                            'Information Technology industry. Average income '
                            'is 68,285 Kro-bro-ünzes, and distributed '
                            'extremely evenly, with little difference between '
                            'the richest and poorest citizens.',
                 'government': 'The Hive Mind of Testlandia is a gargantuan, '
                               'genial nation, ruled by Violet with an even '
                               'hand, and renowned for its rum-swilling '
                               'pirates, hatred of cheese, and stringent '
                               'health and safety legislation. The '
                               'compassionate, democratic population of 46.479 '
                               'billion Testlandians have some civil rights, '
                               'but not too many, enjoy the freedom to spend '
                               'their money however they like, to a point, and '
                               'take part in free and open elections, although '
                               'not too often.\n'
                               'It is difficult to tell where the omnipresent '
                               'government stops and the rest of society '
                               'begins, but it juggles the competing demands '
                               'of Healthcare, Environment, and Education. It '
                               'meets to discuss matters of state in the '
                               'capital city of Tést City. The average income '
                               'tax rate is 88.9%, and even higher for the '
                               'wealthy.\n',
                 'more': "Political detractors refer to Violet as 'that "
                         "Bigtopian puppet', dubiously qualified Skandilundian "
                         "barristers keep referring to laws as 'government "
                         "guidelines', Violet's office has a newly installed "
                         'Max-Man arcade game programmed by a 5th-grader, and '
                         'Testlandians struggle to cut tofu steak with a '
                         'spoon. Crime is totally unknown, thanks to a very '
                         'well-funded police force and progressive social '
                         "policies in education and welfare.  Testlandia's "
                         'national animal is the ★★★ nautilus ★★★, which '
                         "frolics freely in the nation's sparkling oceans, and "
                         'its national religion is Neo-Violetism.'},
 'flag': 'www.nationstates.net/images/flags/uploads/testlandia__853435.png',
 'long_name': 'The Hive Mind of Testlandia',
 'motto': 'New forum when?',
 'short_name': 'Testlandia',
 'wa_category': 'Inoffensive Centrist Democracy'}
```

Activity:

``` python
from awesomeNations import AwesomeNations as awn

nation = awn.Nation('testlandia')

AwesomeActivity = nation.get_activity(filters='all') # Returns a generator object, None if no activities.

# Be aware that Testlandia is pretty sleepy recently, so they might be kinda inactive!
if AwesomeActivity:
    for event in AwesomeActivity:
        print(event)
else:
    print('No events.')
```

Output:

``` bash
4 days ago: Testlandia changed its national motto to "New forum when?".
5 days ago: Testlandia altered its national flag.
5 days ago: Testlandia altered its national flag.
```

## Region Features: ⸜(。˃ ᵕ ˂ )⸝♡

Region overview:

``` python
from awesomeNations import AwesomeNations as awn
from pprint import pprint as pp

region = awn.Region('The Pacific')

overview = region.get_overview()
pp(overview)
```

Output:

``` bash
{'category': 'The Pacific is a Feeder. New nations are founded here at an '
             'elevated rate.',
 'founder': None,
 'governor': None,
 'last_wa_update': 'Last WA Update: 2 hours ago',
 'region_banner': 'https://www.nationstates.net/images/rbanners/uploads/the_pacific__638034.jpg',  
 'region_flag': 'https://www.nationstates.net/images/flags/uploads/rflags/the_pacific__176518.png',
 'wa_delegate': 'WA Delegate: The New Pacific Ocelot Empress of Xoriet '
                '(elected 157 days ago)'}
```

Get embassies from the desired region:

``` python
from awesomeNations import AwesomeNations as awn

region = awn.Region('The Pacific')

embassies = region.get_embassies()
for embassy in embassies:
    print(embassy)
```

Output:

``` bash
{'region': 'The New Pacific Order', 'duration': '9 years 84 days'}
{'region': 'The West Pacific', 'duration': '4 years 341 days'}
{'region': 'Lone Wolves United', 'duration': '1 year 352 days'}
{'region': 'The North Pacific', 'duration': '5 years 77 days'}
{'region': 'The East Pacific', 'duration': '9 years 132 days'}
{'region': 'Balder', 'duration': '5 years 133 days'}
{'region': 'Lazarus', 'duration': '2 years 134 days'}
{'region': 'Ridgefield', 'duration': '124 days'}
{'region': 'Anteria', 'duration': '122 days'}
{'region': 'Cape of Good Hope', 'duration': '124 days'}
{'region': 'Lands End', 'duration': '122 days'}
{'region': 'Conch Kingdom', 'duration': '124 days'}
{'region': 'Narnia', 'duration': '80 days'}
{'region': 'Dawn', 'duration': '70 days'}
{'region': 'The League', 'duration': '1 year 326 days'}
{'region': 'Atlantic', 'duration': '8 years 332 days'}
...
```

## Reference 三三ᕕ( ᐛ )ᕗ

**Nation Methods:**

- exists() -> bool: Check if a nation exists.
- get_overview() -> dict: Get an overview of a nation.
- get_activity() -> Iterator: Retrieve national happenings.
- get_census() -> Iterator: Retrieve census data.

**Region Methods:**

- exists() -> bool: Check if a region exists.
- get_overview() -> dict: Returns an overview of a region.
- get_activity() -> Iterator: Retrieve regional happenings.
- get_world_census() -> Iterator: Retrieve region's world census rankings.
- get_embassies() -> Iterator: Retrieves embassies of the requested region.

# Awesome Changelog <(˶ᵔᵕᵔ˶)> 𓂃🖊

## </> 0.1.0 </>:

**07/01/2025**

- Region support;
- License addition;
- Scraping efficiency improvement;
- Changelog addition;
- Exceptions improvements;
- Code examples;
- Github repository creation;
- Less cringe.

## </> 0.0.4 </>:

**22/11/2024**

- First dummy release, hello... World...?

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "awesomeNations",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "NationStates, Scrapper, Web Scrapper, NationStates scrapper",
    "author": "Orly Neto",
    "author_email": "orly2carvalhoneto@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/46/f1/0678f24e488e2944b0b70dc6e2564a6cec6647c2299beaf47cec20510eea/awesomenations-0.1.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\r\n  <img src=\"https://i.imgur.com/yQ9gI82.png\" />\r\n</p>\r\n\r\n<h1 align=\"center\">AwesomeNations</h1>\t\r\n\r\n![Python](https://img.shields.io/badge/python-3.10%2B-blue)\r\n![License](https://img.shields.io/badge/license-MIT-green)\r\n\r\n**AwesomeNations** is a clumsy Python library for scraping data from [NationStates](https://www.nationstates.net), a browser-based nation simulation game created at 13 November 2002 by Max Barry- Oh wait, nobody cares about real life lore. Anyways, this library allows you to collect nation and region data, retrieve census statistics, and much gore- more.\r\n\r\nYou can install AwesomeNations using pip:\r\n\r\n``` bash\r\npip install awesomeNations\r\n```\r\n\r\nEasy, quick and almost make me forget I spent months of my life to make this thing work!\r\n\r\n---\r\n\r\n## Nation Features: \u0d26\u0d4d\u0d26\u0d3f(\u02f5 \u2022\u0300 \u1d17 - \u02f5 ) \u2727\r\n\r\nYou can get censuses from a nation doing this:\r\n\r\n``` python\r\nfrom awesomeNations import AwesomeNations as awn\r\n\r\nnation = awn.Nation('testlandia')\r\n\r\nAwesomeData = nation.get_census((0, 2, 4, 46, 88)) # Returns a generator object\r\n\r\nfor census in AwesomeData:\r\n    print(census)\r\n```\r\n\r\nOutput:\r\n\r\n``` bash\r\n{'title': 'Civil Rights', 'value': '65.50', 'bubbles': {'world_rank': '96,109th', 'region_rank': '12th'}}\r\n{'title': 'Political Freedom', 'value': '70.86', 'bubbles': {'world_rank': '88,471st', 'region_rank': '13th'}}\r\n{'title': 'Wealth Gaps', 'value': '1.41', 'bubbles': {'world_rank': '288,472nd', 'region_rank': '44th'}}\r\n{'title': 'Defense Forces', 'value': '7,512.87', 'bubbles': {'world_rank': '26,476th', 'region_rank': '12th'}}      \r\n{'title': 'Food Quality', 'value': '139.90', 'bubbles': {'world_rank': '13,306th', 'region_rank': '6th'}}\r\n```\r\n\r\nNation overview:\r\n\r\n``` python\r\nfrom awesomeNations import AwesomeNations as awn\r\nfrom pprint import pprint as pp\r\n\r\nnation = awn.Nation('testlandia')\r\n\r\noverview = nation.get_overview()\r\npp(overview)\r\n```\r\n\r\nOutput:\r\n\r\n``` bash\r\n{'box': {'animal': '\u2605\u2605\u2605 nautilus \u2605\u2605\u2605',\r\n         'capital': 'T\u00e9st City',\r\n         'currency': 'Kro-bro-\u00fcnze',\r\n         'faith': 'Neo-Violetism',\r\n         'leader': 'Violet',\r\n         'population': '46.479 billion'},\r\n 'bubbles': {'civil_rights': 'Very Good',\r\n             'economy': 'Powerhouse',\r\n             'influence': 'Eminence Grise',\r\n             'political_freedom': 'Excellent',\r\n             'region': 'Testregionia'},\r\n 'description': {'economy': 'The powerhouse Testlandian economy, worth a '\r\n                            'remarkable 3,173 trillion Kro-bro-\u00fcnzes a year, '\r\n                            'is driven almost entirely by government activity. '\r\n                            'The industrial sector is solely comprised of the '\r\n                            'Information Technology industry. Average income '\r\n                            'is 68,285 Kro-bro-\u00fcnzes, and distributed '\r\n                            'extremely evenly, with little difference between '\r\n                            'the richest and poorest citizens.',\r\n                 'government': 'The Hive Mind of Testlandia is a gargantuan, '\r\n                               'genial nation, ruled by Violet with an even '\r\n                               'hand, and renowned for its rum-swilling '\r\n                               'pirates, hatred of cheese, and stringent '\r\n                               'health and safety legislation. The '\r\n                               'compassionate, democratic population of 46.479 '\r\n                               'billion Testlandians have some civil rights, '\r\n                               'but not too many, enjoy the freedom to spend '\r\n                               'their money however they like, to a point, and '\r\n                               'take part in free and open elections, although '\r\n                               'not too often.\\n'\r\n                               'It is difficult to tell where the omnipresent '\r\n                               'government stops and the rest of society '\r\n                               'begins, but it juggles the competing demands '\r\n                               'of Healthcare, Environment, and Education. It '\r\n                               'meets to discuss matters of state in the '\r\n                               'capital city of T\u00e9st City. The average income '\r\n                               'tax rate is 88.9%, and even higher for the '\r\n                               'wealthy.\\n',\r\n                 'more': \"Political detractors refer to Violet as 'that \"\r\n                         \"Bigtopian puppet', dubiously qualified Skandilundian \"\r\n                         \"barristers keep referring to laws as 'government \"\r\n                         \"guidelines', Violet's office has a newly installed \"\r\n                         'Max-Man arcade game programmed by a 5th-grader, and '\r\n                         'Testlandians struggle to cut tofu steak with a '\r\n                         'spoon. Crime is totally unknown, thanks to a very '\r\n                         'well-funded police force and progressive social '\r\n                         \"policies in education and welfare.  Testlandia's \"\r\n                         'national animal is the \u2605\u2605\u2605 nautilus \u2605\u2605\u2605, which '\r\n                         \"frolics freely in the nation's sparkling oceans, and \"\r\n                         'its national religion is Neo-Violetism.'},\r\n 'flag': 'www.nationstates.net/images/flags/uploads/testlandia__853435.png',\r\n 'long_name': 'The Hive Mind of Testlandia',\r\n 'motto': 'New forum when?',\r\n 'short_name': 'Testlandia',\r\n 'wa_category': 'Inoffensive Centrist Democracy'}\r\n```\r\n\r\nActivity:\r\n\r\n``` python\r\nfrom awesomeNations import AwesomeNations as awn\r\n\r\nnation = awn.Nation('testlandia')\r\n\r\nAwesomeActivity = nation.get_activity(filters='all') # Returns a generator object, None if no activities.\r\n\r\n# Be aware that Testlandia is pretty sleepy recently, so they might be kinda inactive!\r\nif AwesomeActivity:\r\n    for event in AwesomeActivity:\r\n        print(event)\r\nelse:\r\n    print('No events.')\r\n```\r\n\r\nOutput:\r\n\r\n``` bash\r\n4 days ago: Testlandia changed its national motto to \"New forum when?\".\r\n5 days ago: Testlandia altered its national flag.\r\n5 days ago: Testlandia altered its national flag.\r\n```\r\n\r\n## Region Features: \u2e1c(\uff61\u02c3 \u1d55 \u02c2 )\u2e1d\u2661\r\n\r\nRegion overview:\r\n\r\n``` python\r\nfrom awesomeNations import AwesomeNations as awn\r\nfrom pprint import pprint as pp\r\n\r\nregion = awn.Region('The Pacific')\r\n\r\noverview = region.get_overview()\r\npp(overview)\r\n```\r\n\r\nOutput:\r\n\r\n``` bash\r\n{'category': 'The Pacific is a Feeder. New nations are founded here at an '\r\n             'elevated rate.',\r\n 'founder': None,\r\n 'governor': None,\r\n 'last_wa_update': 'Last WA Update: 2 hours ago',\r\n 'region_banner': 'https://www.nationstates.net/images/rbanners/uploads/the_pacific__638034.jpg',  \r\n 'region_flag': 'https://www.nationstates.net/images/flags/uploads/rflags/the_pacific__176518.png',\r\n 'wa_delegate': 'WA Delegate: The New Pacific Ocelot Empress of Xoriet '\r\n                '(elected 157 days ago)'}\r\n```\r\n\r\nGet embassies from the desired region:\r\n\r\n``` python\r\nfrom awesomeNations import AwesomeNations as awn\r\n\r\nregion = awn.Region('The Pacific')\r\n\r\nembassies = region.get_embassies()\r\nfor embassy in embassies:\r\n    print(embassy)\r\n```\r\n\r\nOutput:\r\n\r\n``` bash\r\n{'region': 'The New Pacific Order', 'duration': '9 years 84 days'}\r\n{'region': 'The West Pacific', 'duration': '4 years 341 days'}\r\n{'region': 'Lone Wolves United', 'duration': '1 year 352 days'}\r\n{'region': 'The North Pacific', 'duration': '5 years 77 days'}\r\n{'region': 'The East Pacific', 'duration': '9 years 132 days'}\r\n{'region': 'Balder', 'duration': '5 years 133 days'}\r\n{'region': 'Lazarus', 'duration': '2 years 134 days'}\r\n{'region': 'Ridgefield', 'duration': '124 days'}\r\n{'region': 'Anteria', 'duration': '122 days'}\r\n{'region': 'Cape of Good Hope', 'duration': '124 days'}\r\n{'region': 'Lands End', 'duration': '122 days'}\r\n{'region': 'Conch Kingdom', 'duration': '124 days'}\r\n{'region': 'Narnia', 'duration': '80 days'}\r\n{'region': 'Dawn', 'duration': '70 days'}\r\n{'region': 'The League', 'duration': '1 year 326 days'}\r\n{'region': 'Atlantic', 'duration': '8 years 332 days'}\r\n...\r\n```\r\n\r\n## Reference \u4e09\u4e09\u1555( \u141b )\u1557\r\n\r\n**Nation Methods:**\r\n\r\n- exists() -> bool: Check if a nation exists.\r\n- get_overview() -> dict: Get an overview of a nation.\r\n- get_activity() -> Iterator: Retrieve national happenings.\r\n- get_census() -> Iterator: Retrieve census data.\r\n\r\n**Region Methods:**\r\n\r\n- exists() -> bool: Check if a region exists.\r\n- get_overview() -> dict: Returns an overview of a region.\r\n- get_activity() -> Iterator: Retrieve regional happenings.\r\n- get_world_census() -> Iterator: Retrieve region's world census rankings.\r\n- get_embassies() -> Iterator: Retrieves embassies of the requested region.\r\n\r\n# Awesome Changelog <(\u02f6\u1d54\u1d55\u1d54\u02f6)> \ud80c\udc83\ud83d\udd8a\r\n\r\n## </> 0.1.0 </>:\r\n\r\n**07/01/2025**\r\n\r\n- Region support;\r\n- License addition;\r\n- Scraping efficiency improvement;\r\n- Changelog addition;\r\n- Exceptions improvements;\r\n- Code examples;\r\n- Github repository creation;\r\n- Less cringe.\r\n\r\n## </> 0.0.4 </>:\r\n\r\n**22/11/2024**\r\n\r\n- First dummy release, hello... World...?\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A simple python web scraping library for NationStates",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "nationstates",
        " scrapper",
        " web scrapper",
        " nationstates scrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4521f329f68dbf3162df46f9bc0fc6a706b4614b8c34f8173c3686815bf01cd",
                "md5": "08c644e19114a1c6609f3dc967e42071",
                "sha256": "2bec8410b5fa3dd818da076e4da26ad1c1b56e0bfa0f1935a5d587e8f7ee9508"
            },
            "downloads": -1,
            "filename": "awesomeNations-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08c644e19114a1c6609f3dc967e42071",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 18283,
            "upload_time": "2025-01-07T23:08:20",
            "upload_time_iso_8601": "2025-01-07T23:08:20.045753Z",
            "url": "https://files.pythonhosted.org/packages/a4/52/1f329f68dbf3162df46f9bc0fc6a706b4614b8c34f8173c3686815bf01cd/awesomeNations-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46f10678f24e488e2944b0b70dc6e2564a6cec6647c2299beaf47cec20510eea",
                "md5": "4cea799cd4238a207b3a82c3e4aac55d",
                "sha256": "150a1c919e22c4830df54be66e8cfab45e622e3db5893b71b7930c4f51893446"
            },
            "downloads": -1,
            "filename": "awesomenations-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4cea799cd4238a207b3a82c3e4aac55d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15441,
            "upload_time": "2025-01-07T23:08:22",
            "upload_time_iso_8601": "2025-01-07T23:08:22.907530Z",
            "url": "https://files.pythonhosted.org/packages/46/f1/0678f24e488e2944b0b70dc6e2564a6cec6647c2299beaf47cec20510eea/awesomenations-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 23:08:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "awesomenations"
}
        
Elapsed time: 0.40732s