@@ -50,7 +50,6 @@ pip install imagekitio
5050The full API of this library can be found in [ api.md] ( api.md ) .
5151
5252``` python
53- import os
5453from imagekitio import ImageKit
5554
5655client = ImageKit(
@@ -122,7 +121,6 @@ print(response.file_id)
122121Simply import ` AsyncImageKit ` instead of ` ImageKit ` and use ` await ` with each API call:
123122
124123``` python
125- import os
126124import asyncio
127125from imagekitio import AsyncImageKit
128126
@@ -163,7 +161,6 @@ pip install imagekitio[aiohttp]
163161Then you can enable it by instantiating the client with ` http_client=DefaultAioHttpClient() ` :
164162
165163``` python
166- import os
167164import asyncio
168165from imagekitio import DefaultAioHttpClient
169166from imagekitio import AsyncImageKit
@@ -506,7 +503,9 @@ from pathlib import Path
506503from imagekitio import ImageKit
507504import io
508505
509- client = ImageKit()
506+ client = ImageKit(
507+ private_key = " My Private Key" ,
508+ )
510509
511510# Method 1: Upload from bytes
512511# Read file into memory first, then upload
@@ -580,7 +579,9 @@ All errors inherit from `imagekitio.APIError`.
580579import imagekitio
581580from imagekitio import ImageKit
582581
583- client = ImageKit()
582+ client = ImageKit(
583+ private_key = " My Private Key" ,
584+ )
584585
585586try :
586587 # Read file into memory and upload
@@ -628,6 +629,7 @@ from imagekitio import ImageKit
628629
629630# Configure the default for all requests:
630631client = ImageKit(
632+ private_key = " My Private Key" ,
631633 # default is 2
632634 max_retries = 0 ,
633635)
@@ -652,12 +654,14 @@ from imagekitio import ImageKit
652654
653655# Configure the default for all requests:
654656client = ImageKit(
657+ private_key = " My Private Key" ,
655658 # 20 seconds (default is 1 minute)
656659 timeout = 20.0 ,
657660)
658661
659662# More granular control:
660663client = ImageKit(
664+ private_key = " My Private Key" ,
661665 timeout = httpx.Timeout(60.0 , read = 5.0 , write = 10.0 , connect = 2.0 ),
662666)
663667
@@ -796,6 +800,7 @@ import httpx
796800from imagekitio import ImageKit, DefaultHttpxClient
797801
798802client = ImageKit(
803+ private_key = " My Private Key" ,
799804 # Or use the `IMAGE_KIT_BASE_URL` env var
800805 base_url = " http://my.test.server.example.com:8083" ,
801806 http_client = DefaultHttpxClient(
@@ -818,7 +823,9 @@ By default the library closes underlying HTTP connections whenever the client is
818823``` py
819824from imagekitio import ImageKit
820825
821- with ImageKit() as client:
826+ with ImageKit(
827+ private_key = " My Private Key" ,
828+ ) as client:
822829 # make requests here
823830 ...
824831
0 commit comments