def get_remote_version(owner, branch):
    """
    Get the version string for the given branch from the remote repo
    :param branch:
    :return:
    """
    import ast

    url = '%s/%s/core.py?q=%s' % (URL_BASE.format(owner=owner), branch, randint(1, 999999))

    try:
        req = requests.get(url)
        lines = req.text.splitlines()
    except:
        raise UpdateError('Network error')
    else:
        if req.status_code == 404:
            raise UpdateError('Repository/branch not found')

    for line in lines:
        if line.startswith('__version__'):
            remote_version = ast.literal_eval(line.split('=')[1].strip())
            return remote_version

    raise UpdateError('Remote version cannot be detected')

    Get the version string for the given branch from the remote repo
    :param branch:
    :return:
    
bin/selfupdate.py