@@ -1064,7 +1064,7 @@ def UploadMediaSimple(self,
10641064 url = '%s/media/upload.json' % self .upload_url
10651065 parameters = {}
10661066
1067- media_fp , filename , file_size , media_type = parse_media_file (media )
1067+ media_fp , _ , _ , _ = parse_media_file (media )
10681068
10691069 parameters ['media' ] = media_fp .read ()
10701070
@@ -3263,7 +3263,6 @@ def IncomingFriendship(self,
32633263 parameters ['count' ] = int (cursor )
32643264 except ValueError :
32653265 raise TwitterError ({'message' : "cursor must be an integer" })
3266- break
32673266 resp = self ._RequestUrl (url , 'GET' , data = parameters )
32683267 data = self ._ParseAndCheckTwitter (resp .content .decode ('utf-8' ))
32693268 result += [x for x in data ['ids' ]]
@@ -3308,7 +3307,6 @@ def OutgoingFriendship(self,
33083307 parameters ['count' ] = int (cursor )
33093308 except ValueError :
33103309 raise TwitterError ({'message' : "cursor must be an integer" })
3311- break
33123310 resp = self ._RequestUrl (url , 'GET' , data = parameters )
33133311 data = self ._ParseAndCheckTwitter (resp .content .decode ('utf-8' ))
33143312 result += [x for x in data ['ids' ]]
@@ -4786,27 +4784,19 @@ def _ParseAndCheckTwitter(self, json_data):
47864784 This is a purely defensive check because during some Twitter
47874785 network outages it will return an HTML failwhale page.
47884786 """
4789- data = None
47904787 try :
47914788 data = json .loads (json_data )
4792- try :
4793- self ._CheckForTwitterError (data )
4794-
4795- except ValueError :
4796- if "<title>Twitter / Over capacity</title>" in json_data :
4797- raise TwitterError ({'message' : "Capacity Error" })
4798- if "<title>Twitter / Error</title>" in json_data :
4799- raise TwitterError ({'message' : "Technical Error" })
4800- if "Exceeded connection limit for user" in json_data :
4801- raise TwitterError ({'message' : "Exceeded connection limit for user" })
4802- if "Error 401 Unauthorized" in json_data :
4803- raise TwitterError ({'message' : "Unauthorized" })
4804- raise TwitterError ({'message' : "Unknown error, try addeding " })
4805-
4806- except :
4789+ except ValueError :
4790+ if "<title>Twitter / Over capacity</title>" in json_data :
4791+ raise TwitterError ({'message' : "Capacity Error" })
4792+ if "<title>Twitter / Error</title>" in json_data :
4793+ raise TwitterError ({'message' : "Technical Error" })
4794+ if "Exceeded connection limit for user" in json_data :
4795+ raise TwitterError ({'message' : "Exceeded connection limit for user" })
48074796 if "Error 401 Unauthorized" in json_data :
48084797 raise TwitterError ({'message' : "Unauthorized" })
4809-
4798+ raise TwitterError ({'Unknown error: {0}' .format (json_data )})
4799+ self ._CheckForTwitterError (data )
48104800 return data
48114801
48124802 def _CheckForTwitterError (self , data ):
0 commit comments