Make connection more reliable
This commit is contained in:
		
							
								
								
									
										7
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.py
									
									
									
									
									
								
							@@ -30,7 +30,12 @@ def treatSuffixes(prefix):
 | 
			
		||||
            print('From file')
 | 
			
		||||
        except:
 | 
			
		||||
            params['qe'] = base
 | 
			
		||||
            text = requests.get(url, params = params).text
 | 
			
		||||
            while True:
 | 
			
		||||
                try:
 | 
			
		||||
                    text = requests.get(url, params = params).text
 | 
			
		||||
                    break
 | 
			
		||||
                except requests.exceptions.ConnectionError:
 | 
			
		||||
                    continue
 | 
			
		||||
            # Pay attention if change `base` elaboration to not allow unwanted folder file writing.
 | 
			
		||||
            with open(baseFilePath, 'w') as requestFile:
 | 
			
		||||
                requestFile.write(text)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user