0

I have created an access point on my raspberry pi, now I wish write a python program to check if an access point has been created or not? is it possible to know through command line or python library. If yes, how? Thank you

1 Answer 1

2

I don't know if there is a library function to check if there is an access point created or not. But on the command line you can use iw or wpa_cli. iw is more generic, with wpa_cli you have to specify the interface name, but you can get more details if needed.

rpi ~$ iw dev | grep 'type AP'
        type AP

# or just check for the return code:
rpi ~$ iw dev | grep --quiet 'type AP'
rpi ~$ echo $?
0

rpi ~$ wpa_cli -iwlan0 status | grep 'mode=AP'
mode=AP

# or just check for the return code:
rpi ~$ wpa_cli -iwlan0 status | grep --quiet 'mode=AP'
rpi ~$ echo $?
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.