I have a python script that displays the local ip and macs of the devices connected to the router and I need to display the device name as well.
You would need to use something like DNS for this purpose unless you know the machines names ahead of time in something like your hosts file or a dictionary.
To perform a DNS lookup in Python the easiest way is to use the sockets library:
import socket
print(socket.gethostbyname(ip_from_search)) # sends out a dns query
The problem with DNS is more than likely you don't have a DNS server for your local network.
Another alternative is to try to connect to the device if you have credentials and pull the hostname that way. For that, the following thread is probably helpful: How to use SSH to run a local shell script on a remote machine?