How can I find the MAC address of a client on the same network, using Python-Flask?
Question: I am looking for a python way grab the client's MAC address. All requests are
over the same network. I am looking for something similar to perform `arp -n
<Client_IP>` on the router.


Answer: Not sure but you can always get Ip address using the request object like

`request.remote_addr` and for that you have to

`import request` and then you can pass this ip to this function

    
    
    import netifaces as nif
    
    def mac_for_ip(ip):
        'Returns a list of MACs for interfaces that have given IP, returns None if not found'
        for i in nif.interfaces():
            addrs = nif.ifaddresses(i)
            try:
                if_mac = addrs[nif.AF_LINK][0]['addr']
                if_ip = addrs[nif.AF_INET][0]['addr']
            except IndexError, KeyError: #ignore ifaces that dont have MAC or IP
                if_mac = if_ip = None
            if if_ip == ip:
                return if_mac
        return None
    

from [here](http://stackoverflow.com/questions/159137/getting-mac-address).

