Skip to content

Commit 338e964

Browse files
authored
Update README.md
1 parent 7e83fd4 commit 338e964

File tree

1 file changed

+82
-52
lines changed

1 file changed

+82
-52
lines changed

README.md

Lines changed: 82 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

22
<img width="1300" height="200" alt="sdk-banner(1)" src="https://github.com/user-attachments/assets/c4a7857e-10dd-420b-947a-ed2ea5825cb8" />
33

4-
<h3 align="center">A Python SDK for the Bright Data's Data extraction and Web unlocking tools, providing easy-to-use scalable methods for web scraping, web searches and more.</h3>
5-
6-
For a quick start run this repo's example files "Codespace" section.
4+
```python
5+
pip install brightdata-sdk
6+
```
7+
<h3 align="center">A Python SDK by Bright Data, providing easy-to-use scalable methods for web search and scraping.</h3>
8+
<p></p>
79

810
## Features
911

@@ -20,8 +22,8 @@ To install the package, open your terminal:
2022

2123
```python
2224
pip install brightdata-sdk
23-
# If using macOS, first open a virtual environment for your project.
2425
```
26+
> If using macOS, first open a virtual environment for your project
2527
2628
## Quick Start
2729

@@ -97,46 +99,27 @@ result = client.scrape(
9799
```python
98100
# Download scraped content
99101
data = client.scrape("https://example.com")
100-
client.download_content(data, "results.json", "json") # Auto-generate filename if not specified
101-
```
102-
103-
## Configuration
104-
105-
### Environment Variables
106-
107-
Create a `.env` file in your project root:
108-
109-
```env
110-
BRIGHTDATA_API_TOKEN=your_bright_data_api_token
111-
WEB_UNLOCKER_ZONE=your_web_unlocker_zone # Optional
112-
SERP_ZONE=your_serp_zone # Optional
102+
client.download_content(data)
113103
```
114104

115-
### Manage Zones
116-
117-
```python
118-
# List all active zones
119-
zones = client.list_zones()
120-
print(f"Found {len(zones)} zones")
121-
```
122-
123-
## API Reference
124-
125-
### bdclient Class
105+
## Function Parameters
106+
<details>
107+
<summary>🔍 <strong>Search(...)</strong></summary>
108+
109+
Searches using the SERP API. Accepts the same arguments as scrape(), plus:
126110

127111
```python
128-
bdclient(
129-
api_token: str = None,
130-
auto_create_zones: bool = True,
131-
web_unlocker_zone: str = None,
132-
serp_zone: str = None,
133-
)
112+
- `query`: Search query string or list of queries
113+
- `search_engine`: "google", "bing", or "yandex"
114+
- Other parameters same as scrape()
134115
```
116+
117+
</details>
118+
<details>
119+
<summary>🔗 <strong>scrape(...)</strong></summary>
135120

136-
### Key Methods
137-
138-
#### scrape(...)
139121
Scrapes a single URL or list of URLs using the Web Unlocker.
122+
140123
```python
141124
- `url`: Single URL string or list of URLs
142125
- `zone`: Zone identifier (auto-configured if None)
@@ -149,30 +132,23 @@ Scrapes a single URL or list of URLs using the Web Unlocker.
149132
- `timeout`: Request timeout in seconds (default: 30)
150133
```
151134

152-
#### search(...)
153-
Searches using the SERP API. Accepts the same arguments as scrape(), plus:
154-
```python
155-
- `query`: Search query string or list of queries
156-
- `search_engine`: "google", "bing", or "yandex"
157-
- Other parameters same as scrape()
158-
```
159-
160-
#### download_content(...)
135+
</details>
136+
<details>
137+
<summary>💾 <strong>Download_Content(...)</strong></summary>
161138

162139
Save content to local file.
140+
163141
```python
164142
- `content`: Content to save
165143
- `filename`: Output filename (auto-generated if None)
166144
- `format`: File format ("json", "csv", "txt", etc.)
167145
```
168146

169-
## Error Handling
170-
171-
The SDK includes built-in input validation and retry logic
172-
173-
In case of zone related problems, use the **list_zones()** function to check your active zones, and check that your [**account settings**](https://brightdata.com/cp/setting/users), to verify that your API key have **"admin permissions"**.
147+
</details>
148+
<details>
149+
<summary>⚙️ <strong>Configuration Constants</strong></summary>
174150

175-
## Configuration Constants
151+
<p></p>
176152

177153
| Constant | Default | Description |
178154
| ---------------------- | ------- | ------------------------------- |
@@ -182,6 +158,60 @@ In case of zone related problems, use the **list_zones()** function to check you
182158
| `MAX_RETRIES` | `3` | Retry attempts on failure |
183159
| `RETRY_BACKOFF_FACTOR` | `1.5` | Exponential backoff multiplier |
184160

161+
</details>
162+
163+
## Advanced Configuration
164+
165+
<details>
166+
<summary>🔧 <strong>Environment Variables</strong></summary>
167+
168+
Create a `.env` file in your project root:
169+
170+
```env
171+
BRIGHTDATA_API_TOKEN=your_bright_data_api_token
172+
WEB_UNLOCKER_ZONE=your_web_unlocker_zone # Optional
173+
SERP_ZONE=your_serp_zone # Optional
174+
```
175+
176+
</details>
177+
<details>
178+
<summary>🌐 <strong>Manage Zones</strong></summary>
179+
180+
List all active zones
181+
182+
```python
183+
# List all active zones
184+
zones = client.list_zones()
185+
print(f"Found {len(zones)} zones")
186+
```
187+
188+
</details>
189+
<details>
190+
<summary>👥 <strong>Client Management</strong></summary>
191+
192+
bdclient Class
193+
194+
```python
195+
bdclient(
196+
api_token: str = None,
197+
auto_create_zones: bool = True,
198+
web_unlocker_zone: str = None,
199+
serp_zone: str = None,
200+
)
201+
```
202+
203+
</details>
204+
<details>
205+
<summary>⚠️ <strong>Error Handling</strong></summary>
206+
207+
bdclient Class
208+
209+
The SDK includes built-in input validation and retry logic
210+
211+
In case of zone related problems, use the **list_zones()** function to check your active zones, and check that your [**account settings**](https://brightdata.com/cp/setting/users), to verify that your API key have **"admin permissions"**.
212+
213+
</details>
214+
185215
## Support
186216

187217
For any issues, contact [Bright Data support](https://brightdata.com/contact), or open an issue in this repository.

0 commit comments

Comments
 (0)