Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-18-2022 04:51 PM
Hello. I tried to connect to my tests1 db via neo4j and HF accounts using py2neo but when I tried to do this I got the error that says I'm not able to connect to db. Examples below.
from py2neo import Graph
class BD_interact():
def __init__(self, protocol, ip_adress, port, bd_name, auth_name, auth_pass):
self.protocol = protocol
self.ip_adress = ip_adress
self.port = port
self.con_address = f'''{self.protocol}://{self.ip_adress}:{self.port}'''
# print(self.con_address)
self.bd_name = bd_name
self.auth_name = auth_name
self.auth_pass = auth_pass
# self.BD_connect()
def BD_connect(self):
self.graph = Graph(self.con_address, auth = (self.auth_name, self.auth_pass), name = self.bd_name)
self.con_status = True
print('[ERROR] Connection wasn\'t established! Try to use another port.' if not self.con_status else '[INFO] Connection established!')
return(self.con_status)
def BD_execute(self, query):
self.response = list(self.graph.run(query).to_table())[0]
return(self.response)
def BD_conncetion_check(self):
return()
bd_window = BD_interact('bolt', 'localhost', 11003, 'tests1', 'HF', 12345678)
bd_window.BD_connect()
What can I do for fix authorization error? I have no idea.
Solved! Go to Solution.
12-19-2022 01:04 AM
Hello,
I have been able to reproduce your error. The problem comes from the password: the driver does not convert int to string and seems to send the bad type to the server. To fix your code, just use a string for the password instead of a number:
bd_window = BD_interact('bolt', 'localhost', 11003, 'tests1', 'HF', '12345678')
12-19-2022 01:04 AM
Hello,
I have been able to reproduce your error. The problem comes from the password: the driver does not convert int to string and seems to send the bad type to the server. To fix your code, just use a string for the password instead of a number:
bd_window = BD_interact('bolt', 'localhost', 11003, 'tests1', 'HF', '12345678')
12-19-2022 05:41 AM
Oh, am, alright. I just wasn't think about it. Thanks you a lot!
All the sessions of the conference are now available online