Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Bearer authorization scheme #295

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion replicate/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def _build_httpx_client(
if (
api_token := api_token or os.environ.get("REPLICATE_API_TOKEN")
) and api_token != "":
headers["Authorization"] = f"Token {api_token}"
headers["Authorization"] = f"Bearer {api_token}"

base_url = (
base_url or os.environ.get("REPLICATE_BASE_URL") or "https://api.replicate.com"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async def test_authorization_when_setting_environ_after_import():
router.route(
method="GET",
url="https://api.replicate.com/",
headers={"Authorization": "Token test-set-after-import"},
headers={"Authorization": "Bearer test-set-after-import"},
).mock(
return_value=httpx.Response(
200,
Expand Down Expand Up @@ -42,7 +42,7 @@ async def test_client_error_handling():
router.route(
method="GET",
url="https://api.replicate.com/",
headers={"Authorization": "Token test-client-error"},
headers={"Authorization": "Bearer test-client-error"},
).mock(
return_value=httpx.Response(
400,
Expand All @@ -69,7 +69,7 @@ async def test_server_error_handling():
router.route(
method="GET",
url="https://api.replicate.com/",
headers={"Authorization": "Token test-server-error"},
headers={"Authorization": "Bearer test-server-error"},
).mock(
return_value=httpx.Response(
500,
Expand Down
Loading