{"id":20638653,"url":"https://github.com/bd808/python-iptools","last_synced_at":"2025-03-17T14:15:50.041Z","repository":{"id":3256067,"uuid":"4294228","full_name":"bd808/python-iptools","owner":"bd808","description":"A few useful functions and objects for manipulating ip addresses in python.","archived":false,"fork":false,"pushed_at":"2020-01-22T23:37:15.000Z","size":113,"stargazers_count":70,"open_issues_count":10,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-02T13:08:55.102Z","etag":null,"topics":["cidr","django","ipv4","ipv6","python"],"latest_commit_sha":null,"homepage":"http://python-iptools.readthedocs.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bd808.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-11T07:25:33.000Z","updated_at":"2024-01-03T14:10:07.000Z","dependencies_parsed_at":"2022-08-17T22:55:50.219Z","dependency_job_id":null,"html_url":"https://github.com/bd808/python-iptools","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bd808%2Fpython-iptools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bd808%2Fpython-iptools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bd808%2Fpython-iptools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bd808%2Fpython-iptools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bd808","download_url":"https://codeload.github.com/bd808/python-iptools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047645,"owners_count":20389206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cidr","django","ipv4","ipv6","python"],"created_at":"2024-11-16T15:19:01.712Z","updated_at":"2025-03-17T14:15:50.019Z","avatar_url":"https://github.com/bd808.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"python-iptools\n==============\n\nThe [iptools][] package is a collection of utilities for dealing with IP\naddresses.\n\n[![Build Status][ci-status]][ci-home]\n\nA few useful functions and objects for manipulating IPv4 and IPv6 addresses in\npython. The project was inspired by a desire to be able to use CIDR address\nnotation to designate `INTERNAL_IPS` in a [Django][] project's settings file.\n\nUsing with Django\n-----------------\n\nThe IpRangeList object can be used in a Django settings file to allow [CIDR][]\nnotation and/or `(start, end)` ranges to be used in the `INTERNAL_IPS` list.\n\nThere are many internal and add-on components for Django that use the\n[INTERNAL_IPS][] configuration setting to alter application behavior or make\ndebugging easier. When you are developing and testing an application by\nyourself it's easy to add the ip address that your web browser will be coming\nfrom to this list. When you are developing in a group or testing from many ips\nit can become cumbersome to add more and more ip addresses to the setting\nindividually.\n\nThe `iptools.IpRangeList` object can help by replacing the standard tuple of\naddresses recommended by the Django docs with an intelligent object that\nresponds to the membership test operator in. This object can be configured\nwith dotted quad IP addresses like the default INTERNAL_IPS tuple (eg.\n'127.0.0.1'), [CIDR][] block notation (eg. '127/8', '192.168/16') for entire\nnetwork blocks, and/or (start, end) tuples describing an arbitrary range of IP\naddresses.\n\nDjango's internal checks against the INTERNAL_IPS tuple take the form `if addr\nin INTERNAL_IPS` or `if addr not in INTERNAL_IPS`. This works transparently with\nthe IpRangeList object because it implements the magic method `__contains__`\nwhich python calls when the `in` or `not in` operators are used.\n\n### Example: ###\n\n    #!/usr/bin/env python\n    import iptools\n\n    INTERNAL_IPS = iptools.IpRangeList(\n        '127.0.0.1',                # single ip\n        '192.168/16',               # CIDR network block\n        ('10.0.0.1', '10.0.0.19'),  # arbitrary inclusive range\n        '::1',                      # single IPv6 address\n        'fe80::/10',                # IPv6 CIDR block\n        '::ffff:172.16.0.2'         # IPv4-mapped IPv6 address\n    )\n\nDocumentation\n-------------\n\nFull pydoc documentation is available at [Read the Docs][].\n\nLocal documentation can be built using [Sphinx][]:\n\n    cd docs\n    make html\n\nPython Version Compatibility\n----------------------------\n\n[Travis CI][ci-home] automatically runs tests against Python 2.7, 3.5, 3.6,\n3.7, 3.8, pypy, and pypy3.\n\nInstallation\n------------\n\nInstall the latest stable version using pip:\n\n    pip install iptools\n\nor easy_install:\n\n    easy_install iptools\n\nInstall the latest development version:\n\n    git clone https://github.com/bd808/python-iptools.git\n    cd python-iptools\n    python setup.py install\n\nContributions\n-------------\nBug reports, feature requests and pull requests are accepted. Preference is\ngiven to issues with well-defined acceptance criteria and/or unit tests.\n\nThis project was originally hosted on [Google Code][].\n\n---\n[iptools]: http://pypi.python.org/pypi/iptools\n[ci-status]: https://secure.travis-ci.org/bd808/python-iptools.png\n[ci-home]: http://travis-ci.org/bd808/python-iptools\n[CIDR]: http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\n[Django]: http://www.djangoproject.com/\n[INTERNAL_IPS]: http://docs.djangoproject.com/en/dev/ref/settings/#internal-ips\n[Read the Docs]: http://python-iptools.readthedocs.org/\n[Sphinx]: http://sphinx.pocoo.org/\n[Google Code]: https://code.google.com/p/python-iptools/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbd808%2Fpython-iptools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbd808%2Fpython-iptools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbd808%2Fpython-iptools/lists"}