mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	python: Catch specific exceptions from requests.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							17ac17286c
						
					
				
				
					commit
					7f69c1d3d5
				
			@@ -449,7 +449,7 @@ def fetch_open_graph_image(url: str) -> Optional[Dict[str, Any]]:
 | 
			
		||||
    # TODO: What if response content is huge? Should we get headers first?
 | 
			
		||||
    try:
 | 
			
		||||
        content = requests.get(url, timeout=1).text
 | 
			
		||||
    except Exception:
 | 
			
		||||
    except requests.RequestException:
 | 
			
		||||
        return None
 | 
			
		||||
    # Extract the head and meta tags
 | 
			
		||||
    # All meta tags are self closing, have no children or are closed
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user