Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def retrieve_account_key():
"""
Retrieves account keys from the web server.
"""
while True:
try:
username = raw_input('Email: ')
password = getpass.getpass()
c = domain_connect(config, Domain.MAIN, Domain)
c.request('POST', ACCOUNT_KEYS_API,
urllib.urlencode({'username': username, 'password': password}),
{
'Referer': 'https://logentries.com/login/',
'Content-type': 'application/x-www-form-urlencoded',
})
response = c.getresponse()
if not response or response.status != 200:
resp_val = 'err'
if response:
resp_val = response.status
if resp_val == 403:
print >> sys.stderr, 'Error: Login failed. Invalid credentials.'
else:
print >> sys.stderr, 'Error: Unexpected login response from logentries (%s).' % resp_val
else: