Skip to content

Commit 602272c

Browse files
authored
Don't set Authorization header unless API token is provided (#167)
Resolves #164 --------- Signed-off-by: Mattt Zmuda <[email protected]>
1 parent ac623f5 commit 602272c

File tree

3 files changed

+2686
-3
lines changed

3 files changed

+2686
-3
lines changed

replicate/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ def __init__(
4949
self.poll_interval = float(os.environ.get("REPLICATE_POLL_INTERVAL", "0.5"))
5050

5151
headers = {
52-
"Authorization": f"Token {api_token}",
5352
"User-Agent": f"replicate-python/{__version__}",
5453
}
5554

55+
if api_token is not None and api_token != "":
56+
headers["Authorization"] = f"Token {api_token}"
57+
5658
transport = kwargs.pop("transport", httpx.HTTPTransport())
5759

5860
self._client = self._build_client(

0 commit comments

Comments
 (0)