import requests import base64 import sys def detect_api(filename): b64 = base64.b64encode(open(sys.argv[1], 'rb').read()).decode('utf8') data = dict(image = b64) response = requests.post('https://bzh.imatag.com/bzh/api/v1.0/detect', headers={'X-Api-Key': 'e80069e02b767fdca459c42fcc5577ab'}, json=data) response.raise_for_status() if response.json()['p-value'] < 1e-3: print("watermark detected") else: print("no watermark detected") if __name__ == '__main__': detect_api(sys.argv[1])