Ejemplo n.º 1
0
def has_community_bumped_post(post_url, post_content):
    if GlobalVars.metasmoke_key is not None and GlobalVars.metasmoke_host is not None:
        try:
            ms_posts = Metasmoke.get_post_bodies_from_ms(post_url)
            if not ms_posts:
                return False

            return any(post['body'] == post_content for post in ms_posts)
        except (requests.exceptions.ConnectionError,
                json.decoder.JSONDecodeError):
            return False  # MS is down, so assume it is not bumped
    return False
Ejemplo n.º 2
0
def has_community_bumped_post(post_url, post_content):
    if GlobalVars.metasmoke_key is not None and GlobalVars.metasmoke_host is not None:
        try:
            ms_posts = Metasmoke.get_post_bodies_from_ms(post_url)
            if not ms_posts:
                return False

            latest_revision_date = max(
                [post['created_at'] for post in ms_posts])
            for post in ms_posts:
                if post['created_at'] == latest_revision_date:
                    if post['body'] == post_content:
                        return True
        except (requests.exceptions.ConnectionError,
                json.decoder.JSONDecodeError):
            return False  # MS is down, so assume it is not bumped
    return False