#NEWLINE# def _retrieve_key( self ) : #NEWLINE# #INDENT# url = 'http://www.canadapost.ca/cpo/mc/personal/postalcode/fpc.jsf' #NEWLINE# text = '' #NEWLINE# try : #NEWLINE# #INDENT# r = requests . get ( url , timeout = self . timeout , proxies = self . proxies ) #NEWLINE# text = r . text #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . error = 'ERROR - URL Connection' #NEWLINE# #UNINDENT# if text : #NEWLINE# #INDENT# expression = "'(....-....-....-....)';" #NEWLINE# pattern = re . compile ( expression ) #NEWLINE# match = pattern . search ( text ) #NEWLINE# if match : #NEWLINE# #INDENT# self . key = match . group ( 1 ) #NEWLINE# return self . key #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . error = 'ERROR - No API Key'