Skip to content

Commit fe5fc71

Browse files
author
Zhen Li
committed
Merge branch '1.1' of https://github.com/neo4j/neo4j-python-driver into 1.1
2 parents 6a745b5 + 70befef commit fe5fc71

File tree

7 files changed

+29
-7
lines changed

7 files changed

+29
-7
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-exclude test *

README.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Example Usage
2424

2525
.. code:: python
2626
27-
from neo4j.v1 import GraphDatabase
28-
driver = GraphDatabase.driver("bolt://localhost")
27+
from neo4j.v1 import GraphDatabase, basic_auth
28+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"))
2929
session = driver.session()
3030
session.run("CREATE (a:Person {name:'Bob'})")
3131
result = session.run("MATCH (a:Person) RETURN a.name AS name")
@@ -41,3 +41,8 @@ Command Line
4141
.. code:: bash
4242
4343
python -m neo4j "CREATE (a:Person {name:'Alice'}) RETURN a, labels(a), a.name"
44+
45+
Changelog
46+
============
47+
48+
Find the changelog in the wiki of this repo

examples/test_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ def test_handle_cypher_error(self):
225225
driver = GraphDatabase.driver("bolt://localhost", auth=auth_token)
226226
session = driver.session()
227227
with self.assertRaises(RuntimeError):
228-
# tag::handle-cypher-error
228+
# tag::handle-cypher-error[]
229229
try:
230230
session.run("This will cause a syntax error").consume()
231231
except CypherError:
232232
raise RuntimeError("Something really bad has happened!")
233233
finally:
234234
session.close()
235-
# end::handle-cypher-error
235+
# end::handle-cypher-error[]

neo4j/meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
# limitations under the License.
2020

2121

22-
version = "1.1.0b1"
22+
version = "1.1.0b1"

neo4j/v1/connection.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,5 +442,12 @@ def connect(host, port=None, ssl_context=None, **config):
442442
if __debug__: log_info("~~ [CLOSE]")
443443
s.shutdown(SHUT_RDWR)
444444
s.close()
445-
else:
445+
elif agreed_version == 1:
446446
return Connection(s, der_encoded_server_certificate=der_encoded_server_certificate, **config)
447+
elif agreed_version == 1213486160:
448+
log_error("S: [CLOSE]")
449+
raise ProtocolError("Server responded HTTP. Make sure you are not trying to connect to the http endpoint " +
450+
"(HTTP defaults to port 7474 whereas BOLT defaults to port 7687)")
451+
else:
452+
log_error("S: [CLOSE]")
453+
raise ProtocolError("Unknown Bolt protocol version: %d", agreed_version)

neokit

test/test_session.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ def test_sessions_are_not_reused_if_still_in_use(self):
9090
session_1.close()
9191
assert session_1 is not session_2
9292

93+
def test_fail_nicely_when_connecting_to_http_port(self):
94+
driver = GraphDatabase.driver("bolt://localhost:7474", auth=auth_token, encrypted=False)
95+
with self.assertRaises(ProtocolError) as context:
96+
driver.session()
97+
98+
assert str(context.exception) == "Server responded HTTP. Make sure you are not trying to connect to the http " \
99+
"endpoint (HTTP defaults to port 7474 whereas BOLT defaults to port 7687)"
100+
101+
93102

94103
class SecurityTestCase(ServerTestCase):
95104

0 commit comments

Comments
 (0)