You can download this code by clicking the button below.
This code is now available for download.
This function uses the pymysql library to create a database connection, accepting the host address and port as parameters.
Technology Stack : pymysql
Code Type : Function
Code Difficulty : Intermediate
def get_random_connection(host, port):
import pymysql
connection = pymysql.connect(host=host, port=port)
return connection