Skip to content

Commit

Permalink
pep8 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanphix committed Nov 26, 2014
1 parent 36aa1f7 commit bc35d4e
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions ghost/ghost.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def javaScriptConfirm(self, frame, message):
message,
)
self.ghost.append_popup_message(message)
value = self.ghost._confirm_expected
value = self.ghost._confirm_expected
self.ghost.logger.info("confirm('%s')" % message)
return self._get_value(value)

Expand Down Expand Up @@ -716,8 +716,18 @@ def toQtCookie(PyCookie):
else:
raise ValueError('unsupported cookie_storage type.')

def open(self, address, method='get', headers={}, auth=None, body=None,
default_popup_response=None, wait=True, timeout=None, client_certificate=None):
def open(
self,
address,
method='get',
headers={},
auth=None,
body=None,
default_popup_response=None,
wait=True,
timeout=None,
client_certificate=None,
):
"""Opens a web page.
:param address: The resource URL.
Expand All @@ -735,7 +745,7 @@ def open(self, address, method='get', headers={}, auth=None, body=None,
finish by other means (e.g. by calling wait_for_page_loaded()).
:param timeout: An optional timeout.
:param client_certificate An optional dict with "certificate_path" and
"key_path" both paths corresponding to the certificate and key files
"key_path" both paths corresponding to the certificate and key files
:return: Page resource, and all loaded resources, unless wait
is False, in which case it returns None.
"""
Expand All @@ -753,18 +763,22 @@ def open(self, address, method='get', headers={}, auth=None, body=None,
if "certificate_path" in client_certificate:
try:
certificate = QtNetwork.QSslCertificate.fromPath(
client_certificate["certificate_path"],
QSsl.Pem)[0]
client_certificate["certificate_path"],
QSsl.Pem,
)[0]
except IndexError:
raise Error("Can't find certicate in %s" % \
client_certificate["certificate_path"])
raise Error(
"Can't find certicate in %s"
% client_certificate["certificate_path"]
)

ssl_conf.setLocalCertificate(certificate)

if "key_path" in client_certificate:
private_key = QtNetwork.QSslKey(
open(client_certificate["key_path"]).read(),
QSsl.Rsa)
open(client_certificate["key_path"]).read(),
QSsl.Rsa,
)
ssl_conf.setPrivateKey(private_key)

QSslConfiguration.setDefaultConfiguration(ssl_conf)
Expand Down

0 comments on commit bc35d4e

Please sign in to comment.