Python Script To Extract SSL certificate issue and expiry date from a specific domain entered by the user in Python 3.11.5

Python script To extract SSL certificate issue and expiry date from a specific domain entered by the user in Python 3.11.5, you can use the ssl and socket libraries. Python Program Code: import ssl import socket def SSL_info(domain): try: context = ssl.create_default_context() with socket.create_connection((domain, 443)) as sock: with context.wrap_socket(sock, server_hostname=domain) as ssock: cert = ssock.getpeercert() issue_date = cert[‘notBefore’] expiry_date = cert[‘notAfter’] return issue_date,… Continue reading Python Script To Extract SSL certificate issue and expiry date from a specific domain entered by the user in Python 3.11.5

Python program that uses the requests and BeautifulSoup packages to scrape the weather forecast for Mumbai from the website.

In this program, we first import the requests and BeautifulSoup packages. We define the URL to scrape as url, which is the weather forecast page for Mumbai on AccuWeather. We then send a GET request to the URL using requests.get and store the response in response. We parse the HTML content of the response using… Continue reading Python program that uses the requests and BeautifulSoup packages to scrape the weather forecast for Mumbai from the website.

Python program that converts minutes to hours, hours to days, and so on

In this program, we first ask the user for input of a number of minutes. We then convert the minutes to hours by dividing by 60. We then convert the hours to days by dividing by 24, and so on, until we have converted weeks to months (assuming 4 weeks per month). We then print… Continue reading Python program that converts minutes to hours, hours to days, and so on

Python program that uses the Wikipedia package to search for a term on Wikipedia and display the summary.

Program Source Code: import wikipedia Ask the user for input search_term = input(“Enter a term to search on Wikipedia: “) Search for the term on Wikipedia try:wikipedia.set_lang(“en”) # Set the language to Englishpage = wikipedia.page(search_term)summary = page.summaryprint(summary)except wikipedia.exceptions.PageError:print(“Sorry, no page on Wikipedia matches your search term.”) In this program, we first import the wikipedia package.… Continue reading Python program that uses the Wikipedia package to search for a term on Wikipedia and display the summary.

Python program that uses the Google Maps API to find the distance between two locations.

First, you’ll need to make sure you have the googlemaps package installed. You can do this by running pip install googlemaps in your terminal. Once you have the package installed, you can use the following code: import googlemapsfrom datetime import datetime Replace ‘YOUR_API_KEY’ with your actual API key gmaps = googlemaps.Client(key=’YOUR_API_KEY’) Ask for user input… Continue reading Python program that uses the Google Maps API to find the distance between two locations.

Python program that asks for the user’s age and checks whether they are old enough to vote.

In this program, we use the built-in input function to ask the user for their age, and then convert the input to an integer using the int function. Next, we use an if statement to check if the user’s age is greater than or equal to 18. If it is, we print a message that the user can vote. Otherwise, we… Continue reading Python program that asks for the user’s age and checks whether they are old enough to vote.