mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Nowy lepszy trunk
Additional lines of code 1 AAA
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
This Python code snippet is connecting to a MySQL database
|
||||
using the `mysql.connector` library and fetching data from a table named `scimag`
|
||||
Here is a breakdown of what the code is doing:
|
||||
"""
|
||||
|
||||
import netrc
|
||||
|
||||
import mysql.connector
|
||||
|
||||
NETRC_FILE = "/home/mtuszowski/.netrc"
|
||||
netrc_mod = netrc.netrc(NETRC_FILE)
|
||||
REMOTE_HOST_NAME = "192.168.1.192"
|
||||
authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME)
|
||||
|
||||
mydb = mysql.connector.connect(
|
||||
host=REMOTE_HOST_NAME,
|
||||
user=authTokens[0],
|
||||
password=authTokens[2],
|
||||
database="scihubdois",
|
||||
)
|
||||
mycursor = mydb.cursor()
|
||||
|
||||
mycursor.execute("SELECT * FROM scimag WHERE Title Like 'spider%'")
|
||||
for x in mycursor:
|
||||
print(x)
|
||||
Reference in New Issue
Block a user