Ask coding questions

← Back to all posts
How to edit .env
BotDevDiscord

How do I edit/update a .env file in replit python?
I tried dotenv.set_key() command but it's returning an error.
Help!

Voters
BotDevDiscord
Comments
hotnewtop
SixBeeps

You cannot and should not programmatically edit Secrets (.env is no longer a thing).

What exactly do you want to do?

BotDevDiscord

@SixBeeps
I'm making a discord bot with clash of clans API. COC API requires you to white list the IP address but replit free version doesn't have static ip. So I have to update it every now and then. I'm trying to update the API without opening replit.

SixBeeps

@BotDevDiscord Is it possible for you to skip using Secrets all together? For example, if your code is like

Just do

BotDevDiscord

@SixBeeps Replet IP always keep changing and i need to create new API key for it, I can only whitelist IP dureing creating API key