Skip to content
Snippets Groups Projects
Commit 610c2ea1 authored by Mark Haines's avatar Mark Haines
Browse files

Fix pep8 and pyflakes warnings

parent 8f8c484b
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,6 @@ import synapse.util.emailutils as emailutils ...@@ -23,7 +23,6 @@ import synapse.util.emailutils as emailutils
import bcrypt import bcrypt
import logging import logging
import urllib
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -101,7 +100,9 @@ class LoginHandler(BaseHandler): ...@@ -101,7 +100,9 @@ class LoginHandler(BaseHandler):
data = yield httpCli.get_json( data = yield httpCli.get_json(
# TODO FIXME This should be configurable. # TODO FIXME This should be configurable.
# XXX: ID servers need to use HTTPS # XXX: ID servers need to use HTTPS
"http://%s%s" % ("matrix.org:8090", "/_matrix/identity/api/v1/lookup"), "http://%s%s" % (
"matrix.org:8090", "/_matrix/identity/api/v1/lookup"
),
{ {
'medium': 'email', 'medium': 'email',
'address': email 'address': email
......
...@@ -168,7 +168,10 @@ class RegistrationHandler(BaseHandler): ...@@ -168,7 +168,10 @@ class RegistrationHandler(BaseHandler):
defer.returnValue(None) defer.returnValue(None)
data = yield httpCli.get_json( data = yield httpCli.get_json(
# XXX: This should be HTTPS # XXX: This should be HTTPS
"http://%s%s" % (creds['idServer'], "/_matrix/identity/api/v1/3pid/getValidated3pid"), "http://%s%s" % (
creds['idServer'],
"/_matrix/identity/api/v1/3pid/getValidated3pid"
),
{'sid': creds['sid'], 'clientSecret': creds['clientSecret']} {'sid': creds['sid'], 'clientSecret': creds['clientSecret']}
) )
...@@ -183,7 +186,9 @@ class RegistrationHandler(BaseHandler): ...@@ -183,7 +186,9 @@ class RegistrationHandler(BaseHandler):
httpCli = SimpleHttpClient(self.hs) httpCli = SimpleHttpClient(self.hs)
data = yield httpCli.post_urlencoded_get_json( data = yield httpCli.post_urlencoded_get_json(
# XXX: Change when ID servers are all HTTPS # XXX: Change when ID servers are all HTTPS
"http://%s%s" % (creds['idServer'], "/_matrix/identity/api/v1/3pid/bind"), "http://%s%s" % (
creds['idServer'], "/_matrix/identity/api/v1/3pid/bind"
),
{ {
'sid': creds['sid'], 'sid': creds['sid'],
'clientSecret': creds['clientSecret'], 'clientSecret': creds['clientSecret'],
......
...@@ -32,15 +32,16 @@ logger = logging.getLogger(__name__) ...@@ -32,15 +32,16 @@ logger = logging.getLogger(__name__)
class SimpleHttpClient(object): class SimpleHttpClient(object):
""" """
A simple, no-frills HTTP client with methods that wrap up common ways of using HTTP in Matrix A simple, no-frills HTTP client with methods that wrap up common ways of
using HTTP in Matrix
""" """
def __init__(self, hs): def __init__(self, hs):
self.hs = hs self.hs = hs
# The default context factory in Twisted 14.0.0 (which we require) is # The default context factory in Twisted 14.0.0 (which we require) is
# BrowserLikePolicyForHTTPS which will do regular cert validation 'like a browser' # BrowserLikePolicyForHTTPS which will do regular cert validation
# 'like a browser'
self.agent = Agent(reactor) self.agent = Agent(reactor)
@defer.inlineCallbacks @defer.inlineCallbacks
def post_urlencoded_get_json(self, uri, args={}): def post_urlencoded_get_json(self, uri, args={}):
logger.debug("post_urlencoded_get_json args: %s", args) logger.debug("post_urlencoded_get_json args: %s", args)
......
...@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__) ...@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
def matrix_federation_endpoint(reactor, destination, ssl_context_factory=None, def matrix_federation_endpoint(reactor, destination, ssl_context_factory=None,
timeout=None): timeout=None):
"""Construct an endpoint for the given matrix destination. """Construct an endpoint for the given matrix destination.
Args: Args:
......
...@@ -62,8 +62,8 @@ class MatrixFederationHttpAgent(_AgentBase): ...@@ -62,8 +62,8 @@ class MatrixFederationHttpAgent(_AgentBase):
class MatrixFederationHttpClient(object): class MatrixFederationHttpClient(object):
"""HTTP client used to talk to other homeservers over the federation protocol. """HTTP client used to talk to other homeservers over the federation
Send client certificates and signs requests. protocol. Send client certificates and signs requests.
Attributes: Attributes:
agent (twisted.web.client.Agent): The twisted Agent used to send the agent (twisted.web.client.Agent): The twisted Agent used to send the
...@@ -305,4 +305,4 @@ class _JsonProducer(object): ...@@ -305,4 +305,4 @@ class _JsonProducer(object):
pass pass
def stopProducing(self): def stopProducing(self):
pass pass
\ No newline at end of file
...@@ -261,7 +261,9 @@ class RegisterRestServlet(RestServlet): ...@@ -261,7 +261,9 @@ class RegisterRestServlet(RestServlet):
) )
if session[LoginType.EMAIL_IDENTITY]: if session[LoginType.EMAIL_IDENTITY]:
logger.debug("Binding emails %s to %s" % (session["threepidCreds"], user_id)) logger.debug("Binding emails %s to %s" % (
session["threepidCreds"], user_id)
)
yield handler.bind_emails(user_id, session["threepidCreds"]) yield handler.bind_emails(user_id, session["threepidCreds"])
result = { result = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment