Skip to content

Commit 1b4a419

Browse files
עידן וילנסקיעידן וילנסקי
authored andcommitted
Change API token environment variable from API_TOKEN to BRIGHTDATA_API_TOKEN
- Update code to use BRIGHTDATA_API_TOKEN instead of API_TOKEN - Update error message and documentation - Update README.md with new environment variable name
1 parent 9184c41 commit 1b4a419

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ from brightdata import bdclient
3535
client = bdclient(api_token="your_api_token_here")
3636

3737
# Or using environment variables
38-
# Set API_TOKEN in your environment or .env file
38+
# Set BRIGHTDATA_API_TOKEN in your environment or .env file
3939
client = bdclient()
4040
```
4141

@@ -107,7 +107,7 @@ print(f"Found {len(zones)} zones")
107107
Create a `.env` file in your project root:
108108

109109
```env
110-
API_TOKEN=your_bright_data_api_token
110+
BRIGHTDATA_API_TOKEN=your_bright_data_api_token
111111
WEB_UNLOCKER_ZONE=your_web_unlocker_zone # Optional
112112
BROWSER_ZONE=your_browser_zone # Optional
113113
SERP_ZONE=your_serp_zone # Optional

brightdata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242
#### Create an account at https://brightdata.com/ to get your API token.
4343
4444
Args:
45-
api_token: Your Bright Data API token (can also be set via API_TOKEN env var)
45+
api_token: Your Bright Data API token (can also be set via BRIGHTDATA_API_TOKEN env var)
4646
auto_create_zones: Automatically create required zones if they don't exist (default: True)
4747
web_unlocker_zone: Custom zone name for web unlocker (default: from env or 'sdk_unlocker')
4848
browser_zone: Custom zone name for browser API (default: from env or 'sdk_browser')
@@ -52,9 +52,9 @@ def __init__(
5252
load_dotenv()
5353
except ImportError:
5454
pass
55-
self.api_token = api_token or os.getenv('API_TOKEN')
55+
self.api_token = api_token or os.getenv('BRIGHTDATA_API_TOKEN')
5656
if not self.api_token:
57-
raise ValueError("API token is required. Provide it as parameter or set API_TOKEN environment variable")
57+
raise ValueError("API token is required. Provide it as parameter or set BRIGHTDATA_API_TOKEN environment variable")
5858
self.web_unlocker_zone = web_unlocker_zone or os.getenv('WEB_UNLOCKER_ZONE', 'sdk_unlocker')
5959
self.browser_zone = browser_zone or os.getenv('BROWSER_ZONE', 'sdk_browser')
6060
self.serp_zone = os.getenv('SERP_ZONE', 'sdk_serp')

0 commit comments

Comments
 (0)