Metadata-Version: 2.1
Name: ip-model
Version: 1.0.1
Summary: A Python package for storing, removing and checking IP's efficiently, Use cases: Blacklisting, Whitelisting etc
Home-page: https://github.com/rakesht2499/Ip-Model
Author: Rakesh Kumar T
Author-email: rakesht2499@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown

[![Generic badge](https://img.shields.io/badge/ip__model-v1.0.0-brightgreen.svg)]()
[![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://github.com/rakesht2499/Ip-Model/blob/master/LICENSE/)

# Ip-Model

A Data Structure for efficiently storing, removing and checking all Ipv4 addresses in O(1) time. 

`v1.0.0` supports for all Ipv4 addresses. 

## Usage

```python
from ip_model.Ipv4 import Ipv4

blacklist = Ipv4()
```

### To add an IP:

```python
# arg: String
blacklist.add("192.0.0.18")
```

### To remove an IP:

```python
# arg: String
blacklist.remove("192.0.0.18")
```

### To check if an IP is present/not:

```python
# arg: String
# returns: bool
blacklist.is_present("192.0.0.18")
```

### Exception Handling

- Throws `TypeError`: passing Invalid Datatype, incorrect number of arguments
- Throws `InvalidIpException`: When an invalid Ip is passed

```python
from ip_model.Exceptions import InvalidIpException

try:
    blacklist.add("192.455.554.343")
except InvalidIpException:
    print("Incorrect Ipv4 Address")
```


