MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / APIAuthenticateClient

Method APIAuthenticateClient

src/api.py:129–143  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

127 self.connection.shutdown(1)
128
129 def APIAuthenticateClient(self):
130 if 'Authorization' in self.headers:
131 # handle Basic authentication
132 (enctype, encstr) = self.headers.get('Authorization').split()
133 (emailid, password) = encstr.decode('base64').split(':')
134 if emailid == BMConfigParser().get('bitmessagesettings', 'apiusername') and password == BMConfigParser().get('bitmessagesettings', 'apipassword'):
135 return True
136 else:
137 return False
138 else:
139 logger.warn('Authentication failed because header lacks Authentication field')
140 time.sleep(2)
141 return False
142
143 return False
144
145 def _decode(self, text, decode_type):
146 try:

Callers 1

_dispatchMethod · 0.95

Calls 3

BMConfigParserClass · 0.90
getMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected