Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get my computer's fully qualified domain name in Python?

I know I can use platform.node() to get my computer's network name:

>>> import platform >>> platform.node() 'MyComputerName' 

But what I really want is something that will work similar to the following:

>>> get_full_network_domain_name() 'MyComputerName.it.na.mycompany.com' 

Does something like this exist?

like image 667
Jace Browning Avatar asked Jul 20 '12 13:07

Jace Browning


People also ask

How do I find the fully qualified domain name of my computer?

To find the FQDN On the Windows Taskbar, click Start > Programs > Administrative Tools > Active Directory Domains and Trusts. In the left pane of the Active Directory Domains and Trusts dialog box, look under Active Directory Domains and Trusts. The FQDN for the computer or computers is listed.

What is fully qualified domain name FQDN )? List an example?

A fully qualified domain name (FQDN) is the complete domain name for a specific computer, or host, on the internet. The FQDN consists of two parts: the hostname and the domain name. For example, an FQDN for a hypothetical mail server might be mymail.somecollege.edu .


1 Answers

The fully qualified domain name is returned by socket.getfqdn().

like image 189
Sven Marnach Avatar answered Oct 06 '22 08:10

Sven Marnach