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
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.
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
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.
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.