Un nom de domaine est une chaîne identifiant un domaine de réseau, il représente une ressource IP, comme un serveur hébergeant un site Web ou simplement un ordinateur ayant accès à Internet.
En termes simples, ce que nous appelons le nom de domaine est l'adresse de votre site Web que les gens tapent dans l'URL du navigateur à visiter.
Dans ce didacticiel, nous utiliserons la bibliothèque whois en Python pour valider les noms de domaine et récupérer diverses informations sur le domaine telles que la date de création et d'expiration, le registraire de domaine, l'adresse et le pays du propriétaire, etc.
Pour commencer, installons la bibliothèque :
pip3 install python-whois
WHOIS est un protocole de requête et de réponse qui est souvent utilisé pour interroger des bases de données qui stockent des noms de domaine enregistrés. Il stocke et diffuse le contenu dans un format lisible par l'homme. La bibliothèque whois interroge simplement un serveur WHOIS directement au lieu de passer par un service Web intermédiaire.
Il existe également une simple commande whois sous Linux pour extraire les informations de domaine , mais puisque nous sommes des développeurs Python, nous utiliserons Python pour cela.
Validation des noms de domaine
Dans cette section, nous utiliserons whois pour dire si un nom de domaine existe et est enregistré, la fonction ci-dessous le fait :
import whois # pip install python-whoisdef is_registered(domain_name): """ A function that returns a boolean indicating whether a `domain_name` is registered """ try: w = whois.whois(domain_name) except Exception: return False else: return bool(w.domain_name)
whois.whois()la fonction lève une exception pour les domaines qui n'existent pas et peut revenir sans lever d'exception même si le domaine n'est pas enregistré, c'est pourquoi nous vérifions s'il
domain_nameexiste, testons cette fonction :
# list of registered & non registered domains to test our function domains = [ "thepythoncode.com", "google.com", "github.com", "unknownrandomdomain.com", "notregistered.co" ] # iterate over domains for domain in domains: print(domain, "is registered" if is_registered(domain) else "is not registered")
Nous avons défini des domaines connus et d'autres qui n'existent pas, voici le résultat :
thepythoncode.com is registered google.com is registered github.com is registered unknownrandomdomain.com is not registered notregistered.co is not registered
Génial, dans la section suivante, nous verrons comment obtenir diverses informations utiles sur les noms de domaine.
Obtenir des informations WHOIS sur le domaine
L'utilisation de cette bibliothèque est assez simple, nous passons simplement le nom de domaine à la
import whois# test with Google domain name domain_name = "google.com" if is_registered(domain_name): whois_info = whois.whois(domain_name)
Maintenant pour obtenir le registrar de domaine (la société qui gère la réservation des noms de domaine), on accède simplement à l'attribut registrar :
# print the registrar print("Domain registrar:", whois_info.registrar)
Obtenir le serveur WHOIS :
# print the WHOIS server print("WHOIS server:", whois_info.whois_server)
Date de création et d'expiration du domaine :
# get the creation time print("Domain creation date:", whois_info.creation_date) # get expiration date print("Expiration date:", whois_info.expiration_date)
Domain registrar: MarkMonitor Inc. WHOIS server: whois.markmonitor.com Domain creation date: 1997-09-15 04:00:00 Expiration date: 2028-09-14 04:00:00
Pour voir d'autres informations WHOIS telles que les serveurs de noms, le pays, la ville, l'état, l'adresse, etc., écrivez simplement
# print all other info print(whois_info)
Voici le code source de l'article : -
Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.
Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is
Syntax: x = lambda arguments : expression
Now i will show you some python lambda function examples:
#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map
No programming language is pretty much as diverse as Python. It enables building cutting edge applications effortlessly. Developers are as yet investigating the full capability of end-to-end Python development services in various areas.
By areas, we mean FinTech, HealthTech, InsureTech, Cybersecurity, and that's just the beginning. These are New Economy areas, and Python has the ability to serve every one of them. The vast majority of them require massive computational abilities. Python's code is dynamic and powerful - equipped for taking care of the heavy traffic and substantial algorithmic capacities.
Programming advancement is multidimensional today. Endeavor programming requires an intelligent application with AI and ML capacities. Shopper based applications require information examination to convey a superior client experience. Netflix, Trello, and Amazon are genuine instances of such applications. Python assists with building them effortlessly.
Python can do such numerous things that developers can't discover enough reasons to admire it. Python application development isn't restricted to web and enterprise applications. It is exceptionally adaptable and superb for a wide range of uses.
Python is known for its tools and frameworks. There's a structure for everything. Django is helpful for building web applications, venture applications, logical applications, and mathematical processing. Flask is another web improvement framework with no conditions.
Web2Py, CherryPy, and Falcon offer incredible capabilities to customize Python development services. A large portion of them are open-source frameworks that allow quick turn of events.
Simple to read and compose
Python has an improved sentence structure - one that is like the English language. New engineers for Python can undoubtedly understand where they stand in the development process. The simplicity of composing allows quick application building.
The motivation behind building Python, as said by its maker Guido Van Rossum, was to empower even beginner engineers to comprehend the programming language. The simple coding likewise permits developers to roll out speedy improvements without getting confused by pointless subtleties.
Utilized by the best
Alright - Python isn't simply one more programming language. It should have something, which is the reason the business giants use it. Furthermore, that too for different purposes. Developers at Google use Python to assemble framework organization systems, parallel information pusher, code audit, testing and QA, and substantially more. Netflix utilizes Python web development services for its recommendation algorithm and media player.
Massive community support
Python has a steadily developing community that offers enormous help. From amateurs to specialists, there's everybody. There are a lot of instructional exercises, documentation, and guides accessible for Python web development solutions.
Today, numerous universities start with Python, adding to the quantity of individuals in the community. Frequently, Python designers team up on various tasks and help each other with algorithmic, utilitarian, and application critical thinking.
Python is the greatest supporter of data science, Machine Learning, and Artificial Intelligence at any enterprise software development company. Its utilization cases in cutting edge applications are the most compelling motivation for its prosperity. Python is the second most well known tool after R for data analytics.
The simplicity of getting sorted out, overseeing, and visualizing information through unique libraries makes it ideal for data based applications. TensorFlow for neural networks and OpenCV for computer vision are two of Python's most well known use cases for Machine learning applications.
Thinking about the advances in programming and innovation, Python is a YES for an assorted scope of utilizations. Game development, web application development services, GUI advancement, ML and AI improvement, Enterprise and customer applications - every one of them uses Python to its full potential.
The disadvantages of Python web improvement arrangements are regularly disregarded by developers and organizations because of the advantages it gives. They focus on quality over speed and performance over blunders. That is the reason it's a good idea to utilize Python for building the applications of the future.
#python development services #python development company #python app development #python development #python in web development #python software development
When you write a program in python that particular code is written line by line. Which means there are kind of sentences in your code. These sentences can be identified under two main groups according to the reason why you are adding them into your code.
To make it easy for you I will name them as Python statements and Python comments.
Instructions that you write in your code and that a **Python interpreter **can execute are called statements.
Wait what! Python interpreter? What’s that?
Let me make it clear to you.
Python interpreter is nothing but a converter which converts the Python language to machine language. Your computer’s hardware obviously can’t understand Python. Therefore, there has to be something that makes the computer understand what you want to be done using your Python code. That is basically done by the Python interpreter. Piece of cake!
Still no idea what really Python statements are?
Don’t worry! Help is on the way!
#python-programming #comments-in-python #statements-in-python #python-comments #python-statements
Python is awesome, it’s one of the easiest languages with simple and intuitive syntax but wait, have you ever thought that there might ways to write your python code simpler?
In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.
Swapping value in Python
Instead of creating a temporary variable to hold the value of the one while swapping, you can do this instead
>>> FirstName = "kalebu" >>> LastName = "Jordan" >>> FirstName, LastName = LastName, FirstName >>> print(FirstName, LastName) ('Jordan', 'kalebu')
#python #python-programming #python3 #python-tutorials #learn-python #python-tips #python-skills #python-development
Today you’re going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates.
In many situations you may find yourself having duplicates files on your disk and but when it comes to tracking and checking them manually it can tedious.
Heres a solution
Instead of tracking throughout your disk to see if there is a duplicate, you can automate the process using coding, by writing a program to recursively track through the disk and remove all the found duplicates and that’s what this article is about.
But How do we do it?
If we were to read the whole file and then compare it to the rest of the files recursively through the given directory it will take a very long time, then how do we do it?
The answer is hashing, with hashing can generate a given string of letters and numbers which act as the identity of a given file and if we find any other file with the same identity we gonna delete it.
There’s a variety of hashing algorithms out there such as
#python-programming #python-tutorials #learn-python #python-project #python3 #python #python-skills #python-tips