Skip to content

Commit

Permalink
chore(types): add whitelist blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Jul 6, 2024
1 parent e6a28ec commit 1d53152
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions javascript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spider-cloud/spider-client",
"version": "0.0.48",
"version": "0.0.49",
"description": "A Javascript SDK for Spider Cloud services",
"scripts": {
"test": "node --import tsx --test __tests__/*test.ts",
Expand Down
14 changes: 12 additions & 2 deletions javascript/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ export interface SpiderParams {
*/
budget?: Budget;

/**
* The blacklist routes to ignore. This can be a Regex string pattern.
*/
black_list?: string[];

/**
* The whitelist routes to only crawl. This can be a Regex string pattern and used with black_listing.
*/
white_list?: string[];

/**
* The locale to be used during the crawl.
*/
Expand Down Expand Up @@ -230,6 +240,6 @@ export type SpiderCoreResponse = {
status?: number;
// The website url.
url?: string;
}
};

export type ChunkCallbackFunction = (data: SpiderCoreResponse) => void
export type ChunkCallbackFunction = (data: SpiderCoreResponse) => void;
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read_file(fname):

setup(
name="spider-client",
version="0.0.48",
version="0.0.49",
url="https://github.com/spider-rs/spider-clients/tree/main/python",
author="Spider",
author_email="[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion python/spider/spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def _prepare_headers(self, content_type: str = "application/json"):
return {
"Content-Type": content_type,
"Authorization": f"Bearer {self.api_key}",
"User-Agent": f"Spider-Client/0.0.48",
"User-Agent": f"Spider-Client/0.0.49",
}

def _post_request(self, url: str, data, headers, stream=False):
Expand Down
8 changes: 7 additions & 1 deletion python/spider/spider_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class RequestParamsDict(TypedDict, total=False):
# The budget for various resources.
budget: Optional[Dict[str, int]]

# The blacklist routes to ignore. This can be a Regex string pattern.
black_list: Optional[List[str]]

# The whitelist routes to only crawl. This can be a Regex string pattern and used with black_listing.
white_list: Optional[List[str]]

# The locale to be used during the crawl.
locale: Optional[str]

Expand Down Expand Up @@ -114,4 +120,4 @@ class RequestParamsDict(TypedDict, total=False):
chunking_alg: Optional[ChunkingAlgDict]


JsonCallback = Callable[[dict], None]
JsonCallback = Callable[[dict], None]

0 comments on commit 1d53152

Please sign in to comment.