Skip to content
Sign upLog in
← Back to Community

How do I hide info or a file from the user

Profile icon
Foster_Bryant

I have a json file with an api key and I don't want people to be able to see it but I still want to put it on repl.it.

Answered by Vandesm14 [earned 5 cycles]
View Answer
Voters
Profile icon
AryamanHM
Profile icon
Foster_Bryant
Comments
hotnewtop
Profile icon
Vandesm14
Profile icon
Foster_Bryant

@Vandesm14
thanks Ill count it as an answer once I test when I get back from school thanks

Profile icon
Foster_Bryant

@Vandesm14
How would I do this through a python file if I want to hide json

Profile icon
Vandesm14

@Foster_Bryant Refer to this
You should create a .env file with the following:

APIKEY=<your token>

Example:

APIKEY=12301923102389

And you can reference the key by doing:

import os # Set apikey to the APIKEY in the environment variables apikey = os.environ["APIKEY"] # Print the key to check is works print(apikey)
Profile icon
Foster_Bryant

@Vandesm14
thanks for the example I will count this as the answer and I will test it later thanks