Exemplo n.º 1
0
 def handshake(self):
     self.handshake_attempts += 1
     self.timestamp = self.create_timestamp()
     self.authentication_code = self.create_authentication_code()
     self.url = self.base_url + r"/?" + self.encode_url()
     req = HttpRequest(url=self.url, timeout=10)
     success, response = req.connect()
     print req.handshake_response(response[0])
     if success:
         self.session_id = response[1]
         status = response[0]
         self.submission_url = response[3]
         if status != "OK":
             if self.handshake_attempts <= 3:
                 print "Handshake error attempt %d of 3" % self.handshake_attempts
                 return self.handshake()
             else:
                 return "FAILED", "Failed to make a handshake with Last.fm"
         else:
             self.handshake_attempts = 0
     msg = req.handshake_response(response[0])
     return response[0], msg
Exemplo n.º 2
0
 def handshake(self):
     self.handshake_attempts += 1
     self.timestamp = self.create_timestamp()
     self.authentication_code = self.create_authentication_code()
     self.url = self.base_url + r"/?" + self.encode_url()
     req = HttpRequest(url=self.url, timeout=10)
     success, response = req.connect()
     print req.handshake_response(response[0])
     if success:
         self.session_id = response[1]
         status = response[0]
         self.submission_url = response[3]
         if status != "OK":
             if self.handshake_attempts <= 3:
                 print "Handshake error attempt %d of 3" % self.handshake_attempts
                 return self.handshake()
             else:
                 return "FAILED", "Failed to make a handshake with Last.fm"
         else:
             self.handshake_attempts = 0
     msg = req.handshake_response(response[0])
     return response[0], msg
Exemplo n.º 3
0
 def handshake(self):
     self.timestamp = self.create_timestamp()
     self.authentication_code = self.create_authentication_code()
     self.url += r"/?" + self.encode_url()
     
     req = HttpRequest(url=self.url, timeout=10)
     success, response = req.connect()
        
     if success:
         self.session_id = response[1]
         self.submission_url = response[3]
         
     msg = req.handshake_response(response[0])
     return response[0], msg