Skip to content

Commit ecb67ce

Browse files
feat(api): Update env var name
1 parent bcf925a commit ecb67ce

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml
33
openapi_spec_hash: 1d382866fce3284f26d341f112988d9d
4-
config_hash: 51a9632be24fc533ad69a5bd56934651
4+
config_hash: f1fafe5e607e996b58b67fd1dd3e74fa

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ import os
3232
from imagekit import ImageKit
3333

3434
client = ImageKit(
35-
private_key=os.environ.get(
36-
"IMAGEKIT_PRIVATE_API_KEY"
37-
), # This is the default and can be omitted
35+
private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted
3836
password=os.environ.get(
3937
"OPTIONAL_IMAGEKIT_IGNORES_THIS"
4038
), # This is the default and can be omitted
@@ -49,7 +47,7 @@ print(response.video_codec)
4947

5048
While you can provide a `private_key` keyword argument,
5149
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
52-
to add `IMAGEKIT_PRIVATE_API_KEY="My Private Key"` to your `.env` file
50+
to add `IMAGEKIT_PRIVATE_KEY="My Private Key"` to your `.env` file
5351
so that your Private Key is not stored in source control.
5452

5553
## Async usage
@@ -62,9 +60,7 @@ import asyncio
6260
from imagekit import AsyncImageKit
6361

6462
client = AsyncImageKit(
65-
private_key=os.environ.get(
66-
"IMAGEKIT_PRIVATE_API_KEY"
67-
), # This is the default and can be omitted
63+
private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted
6864
password=os.environ.get(
6965
"OPTIONAL_IMAGEKIT_IGNORES_THIS"
7066
), # This is the default and can be omitted

src/imagekit/_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ def __init__(
9494
"""Construct a new synchronous ImageKit client instance.
9595
9696
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
97-
- `private_key` from `IMAGEKIT_PRIVATE_API_KEY`
97+
- `private_key` from `IMAGEKIT_PRIVATE_KEY`
9898
- `password` from `OPTIONAL_IMAGEKIT_IGNORES_THIS`
9999
- `webhook_secret` from `IMAGEKIT_WEBHOOK_SECRET`
100100
"""
101101
if private_key is None:
102-
private_key = os.environ.get("IMAGEKIT_PRIVATE_API_KEY")
102+
private_key = os.environ.get("IMAGEKIT_PRIVATE_KEY")
103103
if private_key is None:
104104
raise ImageKitError(
105-
"The private_key client option must be set either by passing private_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable"
105+
"The private_key client option must be set either by passing private_key to the client or by setting the IMAGEKIT_PRIVATE_KEY environment variable"
106106
)
107107
self.private_key = private_key
108108

@@ -312,15 +312,15 @@ def __init__(
312312
"""Construct a new async AsyncImageKit client instance.
313313
314314
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
315-
- `private_key` from `IMAGEKIT_PRIVATE_API_KEY`
315+
- `private_key` from `IMAGEKIT_PRIVATE_KEY`
316316
- `password` from `OPTIONAL_IMAGEKIT_IGNORES_THIS`
317317
- `webhook_secret` from `IMAGEKIT_WEBHOOK_SECRET`
318318
"""
319319
if private_key is None:
320-
private_key = os.environ.get("IMAGEKIT_PRIVATE_API_KEY")
320+
private_key = os.environ.get("IMAGEKIT_PRIVATE_KEY")
321321
if private_key is None:
322322
raise ImageKitError(
323-
"The private_key client option must be set either by passing private_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable"
323+
"The private_key client option must be set either by passing private_key to the client or by setting the IMAGEKIT_PRIVATE_KEY environment variable"
324324
)
325325
self.private_key = private_key
326326

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def test_validate_headers(self) -> None:
381381
with pytest.raises(ImageKitError):
382382
with update_env(
383383
**{
384-
"IMAGEKIT_PRIVATE_API_KEY": Omit(),
384+
"IMAGEKIT_PRIVATE_KEY": Omit(),
385385
"OPTIONAL_IMAGEKIT_IGNORES_THIS": Omit(),
386386
}
387387
):
@@ -1272,7 +1272,7 @@ def test_validate_headers(self) -> None:
12721272
with pytest.raises(ImageKitError):
12731273
with update_env(
12741274
**{
1275-
"IMAGEKIT_PRIVATE_API_KEY": Omit(),
1275+
"IMAGEKIT_PRIVATE_KEY": Omit(),
12761276
"OPTIONAL_IMAGEKIT_IGNORES_THIS": Omit(),
12771277
}
12781278
):

0 commit comments

Comments
 (0)