|  |  |  | @ -151,13 +151,13 @@ ACCESS_TOKEN_SECRET = "YOUR_ACCESS_TOKEN_SECRET" | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | class MyStreamListener(tweepy.StreamListener): | 
		
	
		
			
				|  |  |  |  |   def on_status(self, status): | 
		
	
		
			
				|  |  |  |  |     f = open('messages.txt' , 'a') | 
		
	
		
			
				|  |  |  |  |     f.write ("@{}, сообщение номер {}\n {}\n".format( | 
		
	
		
			
				|  |  |  |  |       status.author.screen_name, | 
		
	
		
			
				|  |  |  |  |       status.id_str, | 
		
	
		
			
				|  |  |  |  |       status.text) | 
		
	
		
			
				|  |  |  |  |     ) | 
		
	
		
			
				|  |  |  |  |     f.close()  | 
		
	
		
			
				|  |  |  |  |     with open('messages.txt' , 'a') as f: | 
		
	
		
			
				|  |  |  |  |       f.write ("@{}, сообщение номер {}\n {}\n".format( | 
		
	
		
			
				|  |  |  |  |         status.author.screen_name, | 
		
	
		
			
				|  |  |  |  |         status.id_str, | 
		
	
		
			
				|  |  |  |  |         status.text) | 
		
	
		
			
				|  |  |  |  |       ) | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     print("@{}, сообщение номер {}\n {}\n".format( | 
		
	
		
			
				|  |  |  |  |       status.author.screen_name, | 
		
	
		
			
				|  |  |  |  |       status.id_str, | 
		
	
	
		
			
				
					|  |  |  | @ -168,7 +168,7 @@ class MyStreamListener(tweepy.StreamListener): | 
		
	
		
			
				|  |  |  |  |     if status_code == 420: | 
		
	
		
			
				|  |  |  |  |       return False | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | def monitoring_samara_tweets(query): | 
		
	
		
			
				|  |  |  |  | def monitoring_samara_tweets(api, query=""): | 
		
	
		
			
				|  |  |  |  |   GEOBOX_SAMARA_BIG = [48.9700523344,52.7652295668,50.7251182524,53.6648329274] | 
		
	
		
			
				|  |  |  |  |   myStreamListener = MyStreamListener() | 
		
	
		
			
				|  |  |  |  |   myStream = tweepy.Stream( | 
		
	
	
		
			
				
					|  |  |  | @ -184,7 +184,7 @@ if __name__ == '__main__': | 
		
	
		
			
				|  |  |  |  |       auth = tweepy.OAuthHandler(API_KEY, API_SECRET) | 
		
	
		
			
				|  |  |  |  |       auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) | 
		
	
		
			
				|  |  |  |  |       api = tweepy.API(auth) | 
		
	
		
			
				|  |  |  |  |       monitoring_samara_tweets(query) | 
		
	
		
			
				|  |  |  |  |       monitoring_samara_tweets(api, query) | 
		
	
		
			
				|  |  |  |  |     except Exception as error_msg: | 
		
	
		
			
				|  |  |  |  |       print (error_msg) | 
		
	
		
			
				|  |  |  |  | ``` | 
		
	
	
		
			
				
					|  |  |  | 
 |