Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
caucase
Commits
bd783f0f
Commit
bd783f0f
authored
Sep 20, 2018
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: Define HTTP{,S}Connection class to use as class attributes.
So they can be customised in subclasses.
parent
b3b4ebf1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
caucase/client.py
caucase/client.py
+4
-2
No files found.
caucase/client.py
View file @
bd783f0f
...
@@ -51,6 +51,8 @@ class CaucaseClient(object):
...
@@ -51,6 +51,8 @@ class CaucaseClient(object):
Expose caucase REST API as pythonic methods.
Expose caucase REST API as pythonic methods.
"""
"""
HTTPConnection
=
httplib
.
HTTPConnection
HTTPSConnection
=
httplib
.
HTTPSConnection
@
classmethod
@
classmethod
def
updateCAFile
(
cls
,
url
,
ca_crt_path
):
def
updateCAFile
(
cls
,
url
,
ca_crt_path
):
...
@@ -120,7 +122,7 @@ class CaucaseClient(object):
...
@@ -120,7 +122,7 @@ class CaucaseClient(object):
# XXX: set timeout to HTTP connections ?
# XXX: set timeout to HTTP connections ?
http_url
=
urlparse
(
ca_url
)
http_url
=
urlparse
(
ca_url
)
port
=
http_url
.
port
or
80
port
=
http_url
.
port
or
80
self
.
_http_connection
=
httplib
.
HTTPConnection
(
self
.
_http_connection
=
self
.
HTTPConnection
(
http_url
.
hostname
,
http_url
.
hostname
,
port
,
port
,
#timeout=,
#timeout=,
...
@@ -138,7 +140,7 @@ class CaucaseClient(object):
...
@@ -138,7 +140,7 @@ class CaucaseClient(object):
ssl_context
.
load_cert_chain
(
user_key
)
ssl_context
.
load_cert_chain
(
user_key
)
except
ssl
.
SSLError
as
exc
:
except
ssl
.
SSLError
as
exc
:
raise
ValueError
(
'Failed to load user key: %r'
%
(
exc
,
))
raise
ValueError
(
'Failed to load user key: %r'
%
(
exc
,
))
self
.
_https_connection
=
httplib
.
HTTPSConnection
(
self
.
_https_connection
=
self
.
HTTPSConnection
(
http_url
.
hostname
,
http_url
.
hostname
,
443
if
port
==
80
else
port
+
1
,
443
if
port
==
80
else
port
+
1
,
#timeout=,
#timeout=,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment