Skip to content

Document how to set a custom token #304

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

Closed
wants to merge 2 commits into from

Conversation

zeke
Copy link
Member

@zeke zeke commented May 24, 2024

This PR adds a section to the README documenting how to use a differently named env var to create a client.

Why?

I am using the replicate Python client in an application where REPLICATE_API_TOKEN is not an adequately descriptive name for the environment variable.

I know I could do something like this:

os.environ["REPLICATE_API_TOKEN"] = os.environ["SOME_CUSTOM_REPLICATE_API_TOKEN"]
import replicate

... but I don't want to pollute the environment with a var that could break other things or confuse teammates.

zeke added 2 commits May 24, 2024 09:27
Signed-off-by: Zeke Sikelianos <[email protected]>
it used to be account, but now it's not

Signed-off-by: Zeke Sikelianos <[email protected]>
@mattt
Copy link
Contributor

mattt commented Jun 28, 2024

Hey @zeke. Thanks for sharing this! I saw some opportunities to make the story better in addition to the storytelling, and opened up #318. Would love your feedback on that.

@mattt mattt closed this Jun 28, 2024
mattt added a commit that referenced this pull request Jun 28, 2024
In #268, we allowed custom headers to be passed to client instances.
However, that didn't apply any custom `User-Agent` header. This is now
fixed.

This PR also updates the README to document how to create a custom
client instance, incorporating this new behavior. This PR is an
alternative to #304.

---------

Signed-off-by: Mattt Zmuda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants