Skip to content
← Back to Community
How do I get someone's repl username in python?
Profile icon
RhinoRunner

Is there a way for me to get someone's repl username when they press run on a program?
such as:

from repl import db username = #get the person's username for user in db.keys(): if username.lower() == user: print('That username is already in use!')

How can I do this?

Voters
Profile icon
zrq
Profile icon
RhinoRunner
Comments
hotnewtop
Profile icon
[deleted]

@RhinoRunner

import os username = os.environ['REPL_OWNER'] print(username)

Good luck!

😃

P.S. for the FNAF2, I love it. But...😔, when BB comes in the vent, you said he won't jumpscare you, he will disable some stuff🔦.

He jumpscared😨 me.
Profile icon
RhinoRunner

@XThacker hmm... gotta fix that!
Also, did you jump (from the audio)?

Profile icon
[deleted]

@RhinoRunner duh. 😨😱

Profile icon
[deleted]

@RhinoRunner did i answer your question<._.>

Profile icon
RhinoRunner

@XThacker wait, when it says REPL_OWNER, is it the owner of the repl or is it the person who pressed run??

Profile icon
[deleted]

@RhinoRunner LOL, of course the person who pressed run. I think. 😓. Lemme check

Profile icon
RhinoRunner

@XThacker OK, if it is the person who presses run i will accept your comment!

Profile icon
Buhron

@RhinoRunner the person who runned it

Profile icon
Buhron

Repl name = REPL_SLUG
Username = REPL_OWNER

Profile icon
RhinoRunner

@Buhron thanks but this post was already answered over a year ago...

Profile icon
zrq

This post REALLY helped!

Profile icon
StudioHawaii

thanks

Profile icon
[deleted]

Let's do a test run. Copy that code and then post it somewhere so I can run it too. If it says XThacker, then it works, if it says RhinoRunner, then it doesn't work. Okay?

Profile icon
RhinoRunner

@XThacker Alright here
https://repl.it/@RhinoRunner/os-test#main.py
for me it says:

RhinoRunner
Profile icon
[deleted]

@RhinoRunner YAYAYAY for me it says XThacker. AND I pressed the run button. And youuur the owner. It works! :)

Profile icon
RhinoRunner

@XThacker owo thanks!