def _getdata(self, url, data = "<STR_LIT>"):
request = Request(url)<EOL>if data != "<STR_LIT>":<EOL><INDENT>request = Request(url, urlencode(data))<EOL><DEDENT>try:<EOL><INDENT>response = urlopen(request)<EOL><DEDENT>except HTTPError as e:<EOL><INDENT>print('<STR_LIT>')<EOL>print('<STR_LIT>', e.code)<EOL><DEDENT>except URLError as e:<EOL><INDENT>print('<STR_LIT>')<EOL>print('<STR_LIT>', e.code)<EOL><DEDENT>else:<EOL><INDENT>return response.read()<EOL><DEDENT>
Wrapper method