# ASN Info
A python library providing information about ASNs (AS Name, Country and MANRS membership)
This library downloads the Autonomous System list and information from RIPE NCC and provides its contents as objects.
There are three data points:
- Autonomous System Name: *get_as_name()*
- Autonomous System Country: *get_as_country()*
- Wether an ASN is a MANRS Participant: *is_manrs_participant()*
MANRS Data is not loaded by default, since it requires an API key. In case you want to load it, you will have to prepare a .env file containing a line like this:
```shell
MANRS_API_KEY=ad83444d-4c68-4727-9ff6-ce2df6649c05
```
You can obtain an API key [here](https://www.manrs.org/resources/api/)
Example use:
```python
import asn_info
asn_data = asn_info.Asns()
h = asn_data.load_asn_data(add_manrs_data=True)
print(asn_data.get_as_name(58280))
print(asn_data.get_as_country(58280))
print(asn_data.is_manrs_participant(58280))
```
Result:
```shell
STUCCHIMAX-AS Massimiliano Andrea Stucchi
CH
False
```
You can also filter the ASNs per country, as follows:
```python
switzerland = asn_data.asns_per_country("CH")
for asn in switzerland:
print("{} has {}".format(asn, switzerland[asn]))
```
Output:
```
...
58280 has {'country': 'CH', 'as_name': 'STUCCHIMAX-AS Massimiliano Andrea Stucchi'}
...
```
Raw data
{
"_id": null,
"home_page": "https://github.com/stucchimax/asn_info",
"name": "asn-info",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "asn autonomous systems routing networking",
"author": "Massimiliano Stucchi",
"author_email": "max@stucchi.ch",
"download_url": "https://files.pythonhosted.org/packages/b4/8e/e52d2d47b10cebd2f89f40a5bf083ba7e09c9a1d1cd5501bbde178857e6b/asn_info-0.4.tar.gz",
"platform": null,
"description": "# ASN Info\nA python library providing information about ASNs (AS Name, Country and MANRS membership)\n\nThis library downloads the Autonomous System list and information from RIPE NCC and provides its contents as objects.\n\nThere are three data points:\n\n- Autonomous System Name: *get_as_name()*\n- Autonomous System Country: *get_as_country()*\n- Wether an ASN is a MANRS Participant: *is_manrs_participant()*\n\nMANRS Data is not loaded by default, since it requires an API key. In case you want to load it, you will have to prepare a .env file containing a line like this:\n\n```shell\nMANRS_API_KEY=ad83444d-4c68-4727-9ff6-ce2df6649c05\n```\n\nYou can obtain an API key [here](https://www.manrs.org/resources/api/)\n\nExample use:\n\n```python\nimport asn_info\n\nasn_data = asn_info.Asns()\n\nh = asn_data.load_asn_data(add_manrs_data=True)\n\nprint(asn_data.get_as_name(58280))\nprint(asn_data.get_as_country(58280))\nprint(asn_data.is_manrs_participant(58280))\n\n```\n\nResult:\n\n```shell\nSTUCCHIMAX-AS Massimiliano Andrea Stucchi\nCH\nFalse\n```\n\nYou can also filter the ASNs per country, as follows:\n\n```python\nswitzerland = asn_data.asns_per_country(\"CH\")\n\nfor asn in switzerland:\n print(\"{} has {}\".format(asn, switzerland[asn]))\n```\n\nOutput:\n\n```\n...\n58280 has {'country': 'CH', 'as_name': 'STUCCHIMAX-AS Massimiliano Andrea Stucchi'}\n...\n```\n\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "A python library providing information about ASNs (AS Name, Country and MANRS membership)",
"version": "0.4",
"project_urls": {
"Homepage": "https://github.com/stucchimax/asn_info"
},
"split_keywords": [
"asn",
"autonomous",
"systems",
"routing",
"networking"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2234a7da82fb86e9dcd14182f9bd23727dfb2d1b83de4542c067eaec24b36d18",
"md5": "cfcbb76e166579183a7170da65aeaf79",
"sha256": "c5bb5bb1b26c064940972fed9ed59e9d45a769fc829ac6ce59a9ef7546550853"
},
"downloads": -1,
"filename": "asn_info-0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cfcbb76e166579183a7170da65aeaf79",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4066,
"upload_time": "2024-01-18T13:16:24",
"upload_time_iso_8601": "2024-01-18T13:16:24.224325Z",
"url": "https://files.pythonhosted.org/packages/22/34/a7da82fb86e9dcd14182f9bd23727dfb2d1b83de4542c067eaec24b36d18/asn_info-0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b48ee52d2d47b10cebd2f89f40a5bf083ba7e09c9a1d1cd5501bbde178857e6b",
"md5": "2bc4ece36aa0be695605949479b9f546",
"sha256": "866ccd2349e4db39515caa5a3b9775789ff353741b92bbac7b42f3ad3b94d1e2"
},
"downloads": -1,
"filename": "asn_info-0.4.tar.gz",
"has_sig": false,
"md5_digest": "2bc4ece36aa0be695605949479b9f546",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4053,
"upload_time": "2024-01-18T13:16:25",
"upload_time_iso_8601": "2024-01-18T13:16:25.451767Z",
"url": "https://files.pythonhosted.org/packages/b4/8e/e52d2d47b10cebd2f89f40a5bf083ba7e09c9a1d1cd5501bbde178857e6b/asn_info-0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-18 13:16:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stucchimax",
"github_project": "asn_info",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "python-dotenv",
"specs": []
},
{
"name": "requests",
"specs": []
}
],
"lcname": "asn-info"
}