Skip to content

Instantly share code, notes, and snippets.

@imduffy15
Created September 3, 2013 14:00
Show Gist options
  • Select an option

  • Save imduffy15/6424342 to your computer and use it in GitHub Desktop.

Select an option

Save imduffy15/6424342 to your computer and use it in GitHub Desktop.
def validate_client_secret(self, username, password):
response = requester.cloud_login(app.config['HOST'], username, password)
if response:
#print response.cookies
print response.text
else:
print "empty"
return False
def cloud_login(hostname, username, password):
payload = {'command': 'login', 'username': username, 'password': password,
'response': 'json'}
headers = {'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'}
url = 'http://' + hostname + ':8080/client/api'
request = requests.post(url=url, params=payload, headers=headers)
if request.status_code == 200:
return request
else:
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment