def associate(qs, assoc_secret, assoc_handle):
 q = parseQuery(qs)
 assert (q['openid.mode'] == 'associate')
 assert (q['openid.assoc_type'] == 'HMAC-SHA1')
 reply_dict = {'assoc_type': 'HMAC-SHA1', 'assoc_handle': assoc_handle, 'expires_in': '600'}
 if (q.get('openid.session_type') == 'DH-SHA1'):
  assert ((len(q) == 6) or (len(q) == 4))
  message = Message.fromPostArgs(q)
  session = DiffieHellmanSHA1ServerSession.fromMessage(message)
  reply_dict['session_type'] = 'DH-SHA1'
 else:
  assert (len(q) == 2)
  session = PlainTextServerSession.fromQuery(q)
 reply_dict.update(session.answer(assoc_secret))
 return kvform.dictToKV(reply_dict)

def associate ( qs , assoc_secret , assoc_handle ) : q = parseQuery ( qs ) assert ( q [ 'openid.mode' ] == 'associate' ) assert ( q [ 'openid.assoc_type' ] == 'HMAC-SHA1' ) reply_dict = { 'assoc_type' : 'HMAC-SHA1' , 'assoc_handle' : assoc_handle , 'expires_in' : '600' } if ( q . get ( 'openid.session_type' ) == 'DH-SHA1' ) : assert ( ( len ( q ) == 6 ) or ( len ( q ) == 4 ) ) message = Message . fromPostArgs ( q ) session = DiffieHellmanSHA1ServerSession . fromMessage ( message ) reply_dict [ 'session_type' ] = 'DH-SHA1' else : assert ( len ( q ) == 2 ) session = PlainTextServerSession . fromQuery ( q ) reply_dict . update ( session . answer ( assoc_secret ) ) return kvform . dictToKV ( reply_dict )
do the servers half of the associate call .