import json
import requests


class malwareBazaarApi:
    def malwarebazaar_hash_check(self, hash: str):
        url = "https://mb-api.abuse.ch/api/v1/"
        data = {
            'query': 'get_info',
            'hash': hash
        }
        response = requests.post(url=url,data=data)
        response_json = json.loads(response.text)
        if response.status_code == 200:
            response_json = json.loads(response.text)
            return True, None, response_json
        else:
            return False, {"error": response.status_code}, None