
metashield_clean_up 패키지를 pip로 설치합니다::
pip install metashield_clean_up
파일을 정리하는 예제입니다.
.. code-block:: python
import time
import base64
from metashield_clean_up.api import MetashieldCleanUp
api = MetashieldCleanUp("REPLACE_APP_ID_HERE", "REPLACE_SECRET_KEY_HERE")
with open("file.pdf", "rb") as f:
response = api.clean_file(f.read(), "file.pdf")
clean_id = response.data["cleanId"]
time.sleep(5) # wait until file is cleaned
response2 = api.get_clean_result(clean_id)
decoded = base64.b64decode(response2.data[clean_id])
with open("cleanFile.pdf", "w") as f:
f.write(decoded)
테스트를 실행하기 전에 tests/settings_default.py 모듈에서 일부 설정을 교체하십시오.
테스트는 Python Unittest로 작성되었으며, 다음 명령을 실행하십시오::
python -m unittest discover tests