Skip to content

Commit

Permalink
add async interface to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
meeb committed Jul 27, 2024
1 parent 84eecc5 commit 4f95821
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,38 @@ print(results['name'])
results = whoisit.ip('2404:1234::/32')
print(results['name'])

results = whoisit.entity('ARIN-CHA-1')
results = whoisit.entity('ARIN')
print(results['last_changed_date'])
```

Basic async examples:

```python
import whoisit
import asyncio

async def whoisit_lookups():
results = await whoisit.asn_async(1234)
print(results['name'])
results = await whoisit.domain_async('example.com')
print(results['nameservers'])
results = await whoisit.ip_async('1.2.3.4')
print(results['name'])
results = await whoisit.ip_async('1.2.3.0/24')
print(results['name'])
results = await whoisit.ip_async('2404:1234:1234:1234:1234:1234:1234:1234')
print(results['name'])
results = await whoisit.ip_async('2404:1234::/32')
print(results['name'])
results = await whoisit.entity_async('ARIN')
print(results['last_changed_date'])

loop = asyncio.get_event_loop()
loop.run_until_complete(whoisit.bootstrap_async())
loop.run_until_complete(whoisit_lookups())
loop.close()
```


### Raw response data

Expand Down Expand Up @@ -202,6 +230,12 @@ if whoisit.bootstrap_is_older_than(days=3):
bootstrap_info = whoisit.save_bootstrap_data() # and save it to upload your cache
```

As of `whoisit` version 3.0.0 there is also an optional async interface:

```python
await whoisit.bootstrap_async()
```

A reasonable suggested way to handle bootstrapping data would be to use Memcached or
Redis, for example:

Expand Down Expand Up @@ -492,6 +526,12 @@ whoisit.asn(12345, rir='arin', raw=True)
whoisit.asn(12345, allow_insecure_ssl=True)
```

As of `whoisit` version 3.0.0 there is also an optional async interface:

```python
response = await whoisit.asn_async(12345)
```

### `whoisit.domain(domain=str, raw=bool, allow_insecure_ssl=bool)` -> `dict`

Queries a remote RDAP server for information about the specified domain name. The domain
Expand All @@ -510,6 +550,11 @@ whoisit.domain('example.com', raw=True)
whoisit.domain('example.com', allow_insecure_ssl=True)
```

As of `whoisit` version 3.0.0 there is also an optional async interface:

```python
response = await whoisit.domain_async('example.com')
```

### `whoisit.ip(ip="1.1.1.1", rir=str, raw=bool, allow_insecure_ssl=bool)` -> `dict`

Expand All @@ -534,6 +579,12 @@ whoisit.ip(IPv6Network('2001:4860::/32'), rir='arin')
whoisit.ip('1.1.1.1', allow_insecure_ssl=True)
```

As of `whoisit` version 3.0.0 there is also an optional async interface:

```python
response = await whoisit.ip_async('1.1.1.1')
```

### `whoisit.entity(entity=str, rir=str, raw=bool, allow_insecure_ssl=bool)` -> `dict`

Queries a remote RDAP server for information about the specified entity name. The
Expand All @@ -551,6 +602,12 @@ whoisit.entity('ZG39-ARIN', rir='arin', raw=True)
whoisit.entity('ZG39-ARIN', allow_insecure_ssl=True)
```

As of `whoisit` version 3.0.0 there is also an optional async interface:

```python
response = await whoisit.entity_async('ZG39-ARIN')
```


## Data usage

Expand Down

0 comments on commit 4f95821

Please sign in to comment.