我正在尝试从我当地的Jupyter笔记本连接到Aurora数据库,但它正在抛出
file = 'C:/users/me/webpage.html'
def get_links(file):
import codecs
from bs4 import BeautifulSoup as bs
f = codecs.open(filename, 'r', 'utf-8')
soup = bs(f.read(),'lxml')
link_list = []
A_list = soup.find(string = 'Rob Agerbeek').find_parent('ul').find_all(title = ['Rob Agerbeek', 'Albert Ammons', 'Andrews Sisters', 'Winifred Atwell'])
A_links = [i.get('href') for i in A_list]
link_list += A_links
B_list = soup.find(string = 'Bob Baldori').find_parent('ul').find_all(title = ['Bob Baldori', 'Marcia Ball', 'Deanna Bogart', 'James Booker', 'Eden Brent', 'Dave Brubeck'])
B_links = [i.get('href') for i in B_list]
link_list += B_links
C_list = soup.find(string = 'Francis Craig').find_parent('ul').find_all(title = ['Commander Cody and His Lost Planet Airmen', 'Francis Craig', 'James Crutchfield', 'Ray Charles'])
C_links = [i.get('href') for i in C_list]
link_list += C_links
D_list = soup.find(string = 'Francis Craig').find_parent('ul').find_all(title = ['Caroline Dahl', 'Cow Cow Davenport', 'Blind John Davis', 'Neville Dickie', 'Fats Domino', 'Floyd Domino', 'Dorothy Donegan', 'Georgia Tom Dorsey', 'Dr. John', 'Champion Jack Dupree', 'Big Joe Duskin'])
D_links = [i.get('href') for i in D_list]
link_list +=D_links
E_list = soup.find(string = 'William Ezell').find_parent('ul').find_all(title = ['William Ezell'])
E_links = [i.get('href') for i in E_list]
link_list += E_links
F_list = soup.find(string = 'Wayne Federman').find_parent('ul').find_all(title = ['Wayne Federman', 'Ella Fitzgerald', 'Frankie Ford', 'Ernie Freeman', 'Keith Emerson'])
F_links = [i.get('href') for i in F_list]
link_list +=F_links
G_list = soup.find(string = 'Blind Leroy Garnett').find_parent('ul').find_all(title = ['Blind Leroy Garnett', 'Harry Gibson', 'Harry Gibson'])
G_links = [i.get('href') for i in G_list]
link_list +=G_links
H_list = soup.find(string = 'Willie Hall').find_parent('ul').find_all(title = ['Willie Hall', 'Jools Holland', 'Camille Howard', 'Bob Hall', 'Henri Herbert', 'John Lee Hooker', 'Nicky Hopkins'])
H_links = [i.get('href') for i in H_list]
link_list += H_links
J_list = soup.find(string = 'Elton John').find_parent('ul').find_all(title = ['Elton John', 'Pete Johnson', 'Louis Jordan'])
J_links = [i.get('href') for i in J_list]
link_list += J_links
K_list = soup.find(string = 'Michael Kaeshammer').find_parent('ul').find_all(title = ['Michael Kaeshammer', 'Shizuko Kasagi', 'Joe Krown'])
K_links = [i.get('href') for i in K_list]
link_list += K_links
L_list = soup.find(string = 'Booker T. Laury').find_parent('ul').find_all(title = ['Booker T. Laury', 'Jerry Lee Lewis', 'Meade Lux Lewis', 'Liberace', 'Little Richard', 'Little Willie Littlefield', 'Cripple Clarence Lofton', 'Professor Longhair'])
L_links = [i.get('href') for i in L_list]
link_list += L_links
M_list = soup.find(string = 'Memphis Slim').find_parent('ul').find_all(title = ['Memphis Slim', 'Big Maceo Merriweather', 'Moon Mullican'])
M_links = [i.get('href') for i in M_list]
link_list += M_links
N_list = soup.find(string = 'Romeo Nelson').find_parent('ul').find_all(title = ['Romeo Nelson', 'Charlie Norman'])
N_links = [i.get('href') for i in N_list]
link_list += N_links
P_list = soup.find(string = 'Bill Payne').find_parent('ul').find_all(title = ['Bill Payne', 'Oscar Peterson', 'Piano Red', 'Pinetop Perkins', 'Ross Petot', 'Sammy Price', 'Professor Longhair'])
P_links = [i.get('href') for i in P_list]
link_list += P_links
R_list = soup.find(string = 'Boogie Woogie Red').find_parent('ul').find_all(title = ['Boogie Woogie Red', 'Maurice Rocco', 'Walter Roland', 'Leon Russell'])
R_links = [i.get('href') for i in R_list]
link_list += R_links
S_list = soup.find(string = 'Ulf Sandström').find_parent('ul').find_all(title = ['Ulf Sandström', 'Bob Seeley', 'Luca Sestak', 'Omar Shariff', 'Robert Shaw', 'Freddie Slack', 'Huey "Piano" Smith', 'Clarence "Pine Top" Smith', 'Charlie Spand', 'Otis Spann', 'Speckled Red', 'Roosevelt Sykes'])
S_links = [i.get('href') for i in S_list]
link_list += S_links
T_list = soup.find(string = 'Gene Taylor').find_parent('ul').find_all(title = ['Gene Taylor', 'Montana Taylor', 'George W. Thomas', 'Hersal Thomas', 'Allen Toussaint', 'T. Rex', 'Stephanie Trick', 'Big Joe Turner', 'Ike Turner'])
T_links = [i.get('href') for i in T_list]
link_list += T_links
W_list = soup.find(string = 'Rick Wakeman').find_parent('ul').find_all(title = ['Rick Wakeman', 'Tuts Washington', 'Kenny "Blues Boss" Wayne', 'Vince Weber', 'Robert Wells', 'Clarence Williams', 'Jabo Williams', 'Mitch Woods'])
W_links = [i.get('href') for i in W_list]
link_list += W_links
Y_list = soup.find(string = 'Jimmy Yancey').find_parent('ul').find_all(title = ['Jimmy Yancey'])
Y_links = [i.get('href') for i in Y_list]
link_list += Y_links
Z_list = soup.find(string = 'Silvan Zingg').find_parent('ul').find_all(title = ['Silvan Zingg', 'Axel Zwingenberger', 'ZZ Top'])
Z_links = [i.get('href') for i in Z_list]
link_list += Z_links
return link_list
import sys
import psycopg2
from sqlalchemy import create_engine
from __future__ import division
#Enter the values for you database connection
dbname = "" # e.g. "compose"
host = "" # e.g.: "aws-us-east-1-portal.4.dblayer.com"
port = "" # e.g. 11101
user= "" # e.g. "admin"
pwd = "" # e.g. "xxx"
connstr = "postgresql://" + user + ":" + pwd + "@" + host + ":" + port + "/" + dbname
engine = create_engine(connstr)
这是连接Aurora DB的正确方法吗?