@cache_results<EOL><INDENT>def check(self, package_name, package_version, **extra_data):<DEDENT>
data = extra_data<EOL>data['<STR_LIT>'] = package_name<EOL>data['<STR_LIT>'] = package_version<EOL>data['<STR_LIT>'] = sys.version.split()[<NUM_LIT:0>]<EOL>data['<STR_LIT>'] = platform.platform(True) or '<STR_LIT>'<EOL>try:<EOL><INDENT>headers = {'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT:application/json>'}<EOL>response = requests.put(self.url, json.dumps(data), timeout=<NUM_LIT:1>,<EOL>headers=headers)<EOL>if response.status_code == codes.UNPROCESSABLE_ENTITY:<EOL><INDENT>return '<STR_LIT>'.format(<EOL>package_name)<EOL><DEDENT>data = response.json()<EOL><DEDENT>except (requests.exceptions.RequestException, ValueError):<EOL><INDENT>return None<EOL><DEDENT>if not data or not data.get('<STR_LIT:success>')or (parse_version(package_version) >=<EOL>parse_version(data['<STR_LIT:data>']['<STR_LIT:version>'])):<EOL><INDENT>return None<EOL><DEDENT>return UpdateResult(package_name, running=package_version,<EOL>available=data['<STR_LIT:data>']['<STR_LIT:version>'],<EOL>release_date=data['<STR_LIT:data>']['<STR_LIT>'])<EOL>
Return a UpdateResult object if there is a newer version.