|  |  | @ -1,7 +1,17 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | from os import environ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import requests |  |  |  | import requests | 
			
		
	
		
		
			
				
					
					|  |  |  | import re |  |  |  | import re | 
			
		
	
		
		
			
				
					
					|  |  |  | from bs4 import BeautifulSoup |  |  |  | from bs4 import BeautifulSoup | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | def get_accesstoken_from_file(accesstoken_path): | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     accesstoken_file = open(accesstoken_path, 'r') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     single_accesstoken = accesstoken_file.read().strip() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     accesstoken_file.close() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return single_accesstoken | 
			
		
	
		
		
			
				
					
					|  |  |  | def get_blog(): |  |  |  | def get_blog(): | 
			
		
	
		
		
			
				
					
					|  |  |  |     url = 'https://news.blizzard.com/en-us/' |  |  |  |     url = 'https://news.blizzard.com/en-us/' | 
			
		
	
		
		
			
				
					
					|  |  |  |     html = requests.get(url).text |  |  |  |     html = requests.get(url).text | 
			
		
	
	
		
		
			
				
					|  |  | @ -60,6 +70,17 @@ def get_formatted_body(post): | 
			
		
	
		
		
			
				
					
					|  |  |  |         '<p>'+post['description']+'</p>' |  |  |  |         '<p>'+post['description']+'</p>' | 
			
		
	
		
		
			
				
					
					|  |  |  |     ) |  |  |  |     ) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | homeserver = environ['HOMESERVER_URL'] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | mxid = environ['MXID_PREFIX'] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | admin_room = environ['ADMIN_ROOM'] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | accesstoken = {} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | for key in environ: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (game := re.match('^ACCESSTOKEN_([A-Z]*)_FILE$', key)) is not None: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         accesstoken[game[1].lower()] = get_accesstoken_from_file(environ[key]) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | blog = get_blog() |  |  |  | blog = get_blog() | 
			
		
	
		
		
			
				
					
					|  |  |  | for post in blog: |  |  |  | for post in blog: | 
			
		
	
		
		
			
				
					
					|  |  |  |     print(get_body(post)) |  |  |  |     print(get_body(post)) | 
			
		
	
	
		
		
			
				
					|  |  | 
 |