Skip to content

Commit 5b362b6

Browse files
btschwartz12thehappydinoa
authored andcommitted
chore: add deprecation warnings for search API
1 parent 2a79e23 commit 5b362b6

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-organge.svg?logo=git&logoColor=organge)](http://makeapullrequest.com)
88
[![License](https://img.shields.io/github/license/censys/censys-python?logo=apache)](https://github.com/censys/censys-python/blob/main/LICENSE)
99

10+
> [!WARNING]
11+
> **DEPRECATION NOTICE**: The Censys Search v1 and v2 APIs will be deprecated soon. Please migrate to the new **Censys Platform API**.
12+
>
13+
> - 📖 **New API Documentation**: [https://docs.censys.com/reference/get-started#/](https://docs.censys.com/reference/get-started#/)
14+
> - 📦 **New Python SDK**: Install with `pip install censys-platform` - [https://pypi.org/project/censys-platform/](https://pypi.org/project/censys-platform/)
15+
>
16+
> The **Censys ASM APIs in this library are NOT deprecated** and will continue to be supported.
17+
1018
An easy-to-use and lightweight API wrapper for Censys APIs ([censys.io](https://censys.io/)). Python 3.8+ is currently supported. This library has been tested on Python 3.8 and 3.x (Currently version 3.10).
1119

1220
> **Notice:** The Censys Search v1 endpoints are deprecated as of Nov. 30, 2021. Please begin using v2 endpoints to query hosts and certificates and check out our [support center](https://support.censys.io/hc/en-us/sections/360013076551-Censys-Search-2-0) for resources.

censys/search/v1/api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Base for interacting with the Censys Search API."""
22

33
import os
4+
import warnings
45
from typing import List, Optional, Type
56

67
from requests.models import Response
@@ -39,6 +40,16 @@ def __init__(
3940
Raises:
4041
CensysException: Base Exception Class for the Censys API.
4142
"""
43+
warnings.warn(
44+
"CensysSearchAPIv1 will be deprecated soon. "
45+
"Please migrate to the new Censys Platform API. "
46+
"Visit https://docs.censys.com/reference/get-started#/ for documentation "
47+
"and install the new SDK with: pip install censys-platform "
48+
"(https://pypi.org/project/censys-platform/)",
49+
category=DeprecationWarning,
50+
stacklevel=2,
51+
)
52+
4253
CensysAPIBase.__init__(self, kwargs.pop("url", self.DEFAULT_URL), **kwargs)
4354

4455
# Gets config file

censys/search/v2/api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Base for interacting with the Censys Search API."""
22

33
import os
4+
import warnings
45
from concurrent.futures import ThreadPoolExecutor, as_completed
56
from typing import Any, Dict, Iterable, Iterator, List, Optional, Type, Union
67

@@ -44,6 +45,16 @@ def __init__(
4445
Raises:
4546
CensysException: Base Exception Class for the Censys API.
4647
"""
48+
warnings.warn(
49+
"CensysSearchAPIv2 will be deprecated soon. "
50+
"Please migrate to the new Censys Platform API. "
51+
"Visit https://docs.censys.com/reference/get-started#/ for documentation "
52+
"and install the new SDK with: pip install censys-platform "
53+
"(https://pypi.org/project/censys-platform/)",
54+
category=DeprecationWarning,
55+
stacklevel=2,
56+
)
57+
4758
CensysAPIBase.__init__(self, kwargs.pop("url", self.DEFAULT_URL), **kwargs)
4859

4960
# Gets config file

0 commit comments

Comments
 (0)