{ "info": { "author": "Pier Carlo Chiodi", "author_email": "pierky@pierky.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Networking" ], "description": "ipdetailscache\n==============\n|Build Status| |PYPI Version| |Python Versions|\n\nA Python library to gather IP address details (ASN, prefix, resource holder, reverse DNS) using the RIPEStat API, with a basic cache to avoid flood of requests and to enhance performances.\n\nRequirements / Third-party Libraries\n------------------------------------\n\nPart of this work is based on Google Python IP address manipulation library (https://code.google.com/p/ipaddr-py/) and Jeff Ferland IPy library (https://github.com/autocracy/python-ipy).\n\nYou need either ``ipaddr`` or ``IPy``; versions >=0.2 of this library try to import ``ipaddr``, then fall back on ``IPy``.\n\nYou can install them using ``pip``:\n\n- ``pip install ipaddr``\n- ``pip install IPy``\n\nThe ``pip`` packaged version installs the ``IPy`` library.\n\nInstallation\n============\n\n- Using pip::\n\n pip install ipdetailscache\n\n- Manually, by cloning this repository::\n\n git clone https://github.com/pierky/ipdetailscache.git\n\nTests\n-----\n\nSome tests are provided within the tests directory. You can run them with ``nosetests -vs``.\n\nUsage\n=====\n\nImport the library, then setup a cache object and use it to gather IP address details.\nThe cache object will automatically load and save data to the local cache files.\n\nOptionally, the cache object may be instantiated with the following arguments:\n\n- ``IP_ADDRESSES_CACHE_FILE``, path to the file where IP addresses cache will be stored (default: \"ip_addr.cache\");\n- ``IP_PREFIXES_CACHE_FILE``, path to the file where IP prefixes cache will be stored (default: \"ip_pref.cache\");\n- ``MAX_CACHE``, expiration time for cache entries, in seconds (default: 604800, 1 week);\n- ``dont_save_on_del``, avoid to save the cache on ``__del__`` (default: False, so it saves the cache);\n- ``Debug``, set to True to enable some debug messages (default: False).\n\n``IP_ADDRESSES_CACHE_FILE`` and ``IP_PREFIXES_CACHE_FILE`` can be set to ``None`` to avoid persistent storage of the cache on files.\n\nInternet Exchange Points (IXPs) information\n-------------------------------------------\n\nStarting from version 0.3.0, results can be enriched with Internet Exchange Points (IXPs) IP address space information.\nThis feature is based on PeeringDB.com (www.peeringdb.com) API.\n\nTo enable IXPs info gathering, call the ``UseIXPs`` method of the cache.\n\nResults are given in a dictionary containing the following keys:\n\n::\n\n - ASN [\"\" | \"unknown\" | \"not announced\"]\n - Holder \"string\"\n - Prefix \"string\"\n - HostName \"string\"\n - IsIXP [ None | bool ]\n - IXPName \"string\"\n - TS int\n\nHostname is obtained using the local ``socket.getfqdn`` function.\n\nUsage example::\n\n from pierky.ipdetailscache import IPDetailsCache\n cache = IPDetailsCache( IP_ADDRESSES_CACHE_FILE = \"ip_addr.cache\", IP_PREFIXES_CACHE_FILE = \"ip_pref.cache\", MAX_CACHE = 604800, Debug = False )\n cache.UseIXPs( WhenUse=1, IXP_CACHE_FILE=\"ixps.cache\", MAX_CACHE=604800 )\n result = cache.GetIPInformation( \"IP_ADDRESS\" )\n\nThe ``WhenUse`` argument of ``UseIXPs`` method has this meaning:\n\n- 0: do not use IXPs info;\n- 1: use IXPs info only when can't determine ASN (unknown or not announced)\n- 2: always use IXPs info.\n\nExamples\n========\n\n::\n\n :~# python\n Python 2.7.2+ (default, Jul 20 2012, 22:15:08)\n [GCC 4.6.1] on linux2\n Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n >>> from pierky.ipdetailscache import IPDetailsCache\n >>> cache = IPDetailsCache()\n >>> result = cache.GetIPInformation( \"193.0.6.139\" )\n >>> result\n {'HostName': 'www.ripe.net', 'TS': 1453068601, 'Prefix': u'193.0.0.0/21', 'IsIXP': None, 'IXPName': '', 'Holder': u'RIPE-NCC-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC),NL', 'ASN': '3333'}\n\nExample with UseIXPs, WhenUse=1 (default)\n-----------------------------------------\n\n80.81.203.4 = DE-CIX Hamburg IP, not announced\n\n80.249.208.1 = AMS-IX IP, announced\n\n::\n\n >>> cache.UseIXPs()\n >>> decix_ip=\"80.81.203.4\" # DE-CIX Hamburg IP, not announced\n >>> amsix_ip=\"80.249.208.1\" # AMS-IX IP, announced\n >>> result = cache.GetIPInformation(decix_ip)\n >>> result\n {'HostName': 'ge1-1-12-br2.hamburg10.iphh.net', 'TS': 1453068691, 'Prefix': u'80.81.203.4', 'IsIXP': True, 'IXPName': u'DE-CIX Hamburg', 'Holder': '', 'ASN': 'not announced'}\n >>> result = cache.GetIPInformation(amsix_ip)\n >>> result\n {'HostName': 'rtr-eun-01.ams-ix.net', 'TS': 1453068704, 'Prefix': u'80.249.208.0/21', 'IsIXP': None, 'IXPName': '', 'Holder': u'AMS-IX1 Amsterdam Internet Exchange B.V.,NL', 'ASN': '1200'}\n\nAMS-IX IP is announced, so ``IsIXP`` is ``None`` because no IXP info have been used here.\n\nExample with UseIXPs, WhenUse=2\n-------------------------------\n\nClear local cache with ``rm *.cache``, then:\n\n::\n\n >>> from pierky.ipdetailscache import IPDetailsCache\n >>> cache = IPDetailsCache()\n >>> cache.UseIXPs(WhenUse=2)\n >>> decix_ip=\"80.81.203.4\" # DE-CIX Hamburg IP, not announced\n >>> amsix_ip=\"80.249.208.1\" # AMS-IX IP, announced\n >>> result = cache.GetIPInformation(decix_ip)\n >>> result\n {'HostName': 'ge1-1-12-br2.hamburg10.iphh.net', 'TS': 1453068812, 'Prefix': u'80.81.203.4', 'IsIXP': True, 'IXPName': u'DE-CIX Hamburg', 'Holder': '', 'ASN': 'not announced'}\n >>> result = cache.GetIPInformation(amsix_ip)\n >>> result\n {'HostName': 'rtr-eun-01.ams-ix.net', 'TS': 1453068956, 'Prefix': u'80.249.208.0/21', 'IsIXP': True, 'IXPName': u'AMS-IX', 'Holder': u'AMS-IX1 Amsterdam Internet Exchange B.V.,NL', 'ASN': '1200'}\n\nHere, even if AMS-IX announces its peering LAN prefix, IXPs info have been used to enrich results because ``WhenUse`` is 2.\n\n::\n\n >>> result = cache.GetIPInformation( \"193.0.6.139\" )\n >>> result\n {'HostName': 'www.ripe.net', 'TS': 1453068965, 'Prefix': u'193.0.0.0/21', 'IsIXP': False, 'IXPName': '', 'Holder': u'RIPE-NCC-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC),NL', 'ASN': '3333'}\n\nThe www.ripe.net IP is not on an IXPs peering LAN, so ``IsIXP == False``.\n\nBug? Issues?\n============\nHave a bug? Please create an issue on GitHub at https://github.com/pierky/ipdetailscache/issues\n\nAuthor\n======\n\nPier Carlo Chiodi - https://pierky.com\n\nBlog: https://blog.pierky.com\n\nTwitter: @pierky http://twitter.com/pierky\n\n.. |Build Status| image:: https://travis-ci.org/pierky/ipdetailscache.svg?branch=master\n :target: https://travis-ci.org/pierky/ipdetailscache\n.. |PYPI Version| image:: https://img.shields.io/pypi/v/ipdetailscache.svg\n :target: https://pypi.python.org/pypi/ipdetailscache/\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/ipdetailscache.svg\n :target: https://pypi.python.org/pypi/ipdetailscache/\n\n\nRelease History\n===============\n\n0.4.8\n-----\n\n- Fix a packaging issue.\n\n0.4.7\n-----\n\n- PeeringDB API is no longer in beta: URL updated.\n \n0.4.6\n-----\n\nFixes\n_____\n\n- Wrong behaviour when a cached IP address expires.\n\n0.4.5\n-----\n\nFixes\n_____\n\n- Behaviour change in IXPs info: if WhenUse != 0 check for IXPs info also for cached addresses having IsIXP == None\n\n0.4.4\n-----\n\nFixes\n_____\n\n- Force UTF-8 on IXPs info download\n\n0.4.3\n-----\n\nFixes\n_____\n\n- In case of missing or bad IXPs info from PeeringDB, raise IPDetailsCacheIXPInformationError\n\n0.4.0 to 0.4.2\n---------------\n\nNew Features\n______________\n\n- New packaged version\n- PEP8\n- .md to .rst for better PyPI readability\n\n0.3.0\n--------------\n\nNew Features\n______________\n\n- IXPs information", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/pierky/ipdetailscache", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pierky/ipdetailscache", "keywords": "RIPE,RIPE NCC,RIPE Stat,Library,IPv4,IPv6,IP address", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "ipdetailscache", "package_url": "https://pypi.org/project/ipdetailscache/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ipdetailscache/", "project_urls": { "Download": "https://github.com/pierky/ipdetailscache", "Homepage": "https://github.com/pierky/ipdetailscache" }, "release_url": "https://pypi.org/project/ipdetailscache/0.4.8/", "requires_dist": null, "requires_python": null, "summary": "A Python library to gather IP address details (ASN, prefix, resource holder, reverse DNS) using the RIPEStat API", "version": "0.4.8" }, "last_serial": 2541141, "releases": { "0.4.0": [ { "comment_text": "", "digests": { "md5": "df3125200d9dd747f507c90291c03b95", "sha256": "acd03549bf43a3995d30fe1c35ac85a89db0bdd12e858b333d4573172c78e6a6" }, "downloads": -1, "filename": "ipdetailscache-0.4.0.tar.gz", "has_sig": false, "md5_digest": "df3125200d9dd747f507c90291c03b95", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8171, "upload_time": "2016-01-25T18:04:24", "url": "https://files.pythonhosted.org/packages/4d/b2/98dd3c3a73ade6d7577497c03d6a49dc01a8a3cbec1d87c494639735b7c8/ipdetailscache-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "4c45bdfc04e3968e4c2c2e4e3547bff0", "sha256": "c6ba237d0959d4b4e9061f4ea8a89cf84b7b3ebf1178d5b43c63ee6ca3195a19" }, "downloads": -1, "filename": "ipdetailscache-0.4.1.tar.gz", "has_sig": false, "md5_digest": "4c45bdfc04e3968e4c2c2e4e3547bff0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8252, "upload_time": "2016-01-25T19:55:06", "url": "https://files.pythonhosted.org/packages/98/69/24f63c1fbbef51ce8bbbfa8a087faf77b1b900ebcb502782f8cde29aa338/ipdetailscache-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "8d4d67ff0ebae5f23cc22a25a3932aef", "sha256": "f544f6bb031d0d0c0ba2b6a8ec99ae5c756b0f92e8c8ebd0fb451ecb22575d0a" }, "downloads": -1, "filename": "ipdetailscache-0.4.2.tar.gz", "has_sig": false, "md5_digest": "8d4d67ff0ebae5f23cc22a25a3932aef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8555, "upload_time": "2016-01-26T18:13:39", "url": "https://files.pythonhosted.org/packages/99/8f/6fd2ddc4eb93f2fa2df4379a8b42fbef71b30ac61f641cb6f6cf74be0df7/ipdetailscache-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "b5b0052a0aee186cb8e332084d7cd8eb", "sha256": "aa230ecfdbeb988729d7de2368cd24bbdf06c86b5a3e7d69d9637771538098e5" }, "downloads": -1, "filename": "ipdetailscache-0.4.3.tar.gz", "has_sig": false, "md5_digest": "b5b0052a0aee186cb8e332084d7cd8eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8939, "upload_time": "2016-02-15T17:59:52", "url": "https://files.pythonhosted.org/packages/0b/88/4377a9c795d58c1a386cd6803f5f59a99c22b1bfc76cb52bcc4663e4587f/ipdetailscache-0.4.3.tar.gz" } ], "0.4.4": [ { "comment_text": "", "digests": { "md5": "24c6625e51900f2f8b17f3b56d19244d", "sha256": "fa22ad903e20c8f792ef2f03d740fd01d7f7036fe61bbf092fceef221e02f1e0" }, "downloads": -1, "filename": "ipdetailscache-0.4.4.tar.gz", "has_sig": false, "md5_digest": "24c6625e51900f2f8b17f3b56d19244d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8975, "upload_time": "2016-02-24T16:33:23", "url": "https://files.pythonhosted.org/packages/c5/3b/4600afa409d6ad92ec8e61366b37f5c22afae00d2dd8d6fe2421ff01afc3/ipdetailscache-0.4.4.tar.gz" } ], "0.4.5": [ { "comment_text": "", "digests": { "md5": "29a7e9707bd838ed5d79389dcb4867f4", "sha256": "c9cfdd887f20471077e584058ce2e8600c3f7d28a25849ecfca712885bddda2b" }, "downloads": -1, "filename": "ipdetailscache-0.4.5.tar.gz", "has_sig": false, "md5_digest": "29a7e9707bd838ed5d79389dcb4867f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9121, "upload_time": "2016-02-26T12:42:44", "url": "https://files.pythonhosted.org/packages/c1/39/59b6e445281f2bbc6ddab97743729c0f7ac933668a5574f6009d56260d96/ipdetailscache-0.4.5.tar.gz" } ], "0.4.6": [ { "comment_text": "", "digests": { "md5": "200a6308a393244aef0d1f5d2b13077e", "sha256": "ab7d28f682b37053d8fb782c01274a6badc0bca0e256b10c2686c8d5b36a310f" }, "downloads": -1, "filename": "ipdetailscache-0.4.6.tar.gz", "has_sig": false, "md5_digest": "200a6308a393244aef0d1f5d2b13077e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9164, "upload_time": "2016-03-04T18:05:49", "url": "https://files.pythonhosted.org/packages/53/e3/1b43a6d8c09d1a020cbf9eb66a6cf67ba2aca22a577b1d0836dfc22f7ac7/ipdetailscache-0.4.6.tar.gz" } ], "0.4.7": [ { "comment_text": "", "digests": { "md5": "2a81b5ae4bd6c0a0c9430d1381bacbf9", "sha256": "326b981d86bfe7e8a5edf0a18081591a40b40ec250b9c30a10e045312bc906e4" }, "downloads": -1, "filename": "ipdetailscache-0.4.7.tar.gz", "has_sig": false, "md5_digest": "2a81b5ae4bd6c0a0c9430d1381bacbf9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9154, "upload_time": "2016-03-24T20:23:14", "url": "https://files.pythonhosted.org/packages/b8/34/8b922f1b04dac083878a98029bb488123b5fe170ad099a1aae4fb021a3d2/ipdetailscache-0.4.7.tar.gz" } ], "0.4.8": [ { "comment_text": "", "digests": { "md5": "f2bc62c09ce6297a40fdc713f62e157d", "sha256": "c9a2b1508a75c8cba89a0d3b0804379fbb4186f8e5315fa28d5abe2465e1c4a8" }, "downloads": -1, "filename": "ipdetailscache-0.4.8.tar.gz", "has_sig": false, "md5_digest": "f2bc62c09ce6297a40fdc713f62e157d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9239, "upload_time": "2016-12-27T18:12:03", "url": "https://files.pythonhosted.org/packages/76/ca/3b8a3a4798121f854fd1c0baed3e932b2cfb6056f3140e1747f4d5fb735b/ipdetailscache-0.4.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f2bc62c09ce6297a40fdc713f62e157d", "sha256": "c9a2b1508a75c8cba89a0d3b0804379fbb4186f8e5315fa28d5abe2465e1c4a8" }, "downloads": -1, "filename": "ipdetailscache-0.4.8.tar.gz", "has_sig": false, "md5_digest": "f2bc62c09ce6297a40fdc713f62e157d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9239, "upload_time": "2016-12-27T18:12:03", "url": "https://files.pythonhosted.org/packages/76/ca/3b8a3a4798121f854fd1c0baed3e932b2cfb6056f3140e1747f4d5fb735b/ipdetailscache-0.4.8.tar.gz" } ] }