Using AGOL notebook to get Windows Login

101
2
05-10-2021 08:33 AM
HirokiNozaki
New Contributor

Hello,

I am trying to get users Windows login but unable to figure out how.

I created a Python using Jupyter Notebook and "copy and pasted" my python code to AGOL's notebook.

Originally, I used this code:

"import getpass
winuser = getpass.getuser()

print(winuser)"

In AGOL, this will return AGOL user name.

When I try:

"import os
name = os.environ.get('USERNAME')
print(name)"

It returns "None"

 

Thanks in advance.

0 Kudos
2 Replies
JeffK
by
Occasional Contributor III

try os.getlogin()

0 Kudos
HirokiNozaki
New Contributor

I tried it and got:

[Errno 6] No such device or addres

I assume it is because it goes through a website it can't pull the information out.

I will have to try something else that doesn't use windows username.

Thank you!

0 Kudos