diff --git a/ProteinCartography/esmfold_apiquery.py b/ProteinCartography/esmfold_apiquery.py index d8f90b3..7e72210 100755 --- a/ProteinCartography/esmfold_apiquery.py +++ b/ProteinCartography/esmfold_apiquery.py @@ -2,10 +2,12 @@ import argparse import os import sys +import warnings # depends on api_utils.py from api_utils import session_with_retry from Bio import SeqIO +from requests.packages.urllib3.exceptions import InsecureRequestWarning ### NOTES # ESMFold API example from website: @@ -51,9 +53,11 @@ def post_esmfold_apiquery(fasta: str): Args: fasta (str): string of valid amino acids for query. """ + # Here we're making the request with verify=False to disable SSL + # This may be a security concern, but is (hopefully) + # temporary until the ESM Atlas SSL certificates are fixed result = session_with_retry().post( - "https://api.esmatlas.com/foldSequence/v1/pdb/", - data=fasta, + "https://api.esmatlas.com/foldSequence/v1/pdb/", data=fasta, verify=False ) if result.status_code == 200: return result.text @@ -123,7 +127,12 @@ def main(): input_file = args.input output_file = args.output - esmfold_apiquery(input_file, output_file) + + # Ignore warnings when we make the ESMFold API request + # We're disabling SSL which `requests` will otherwise warn us about + with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=InsecureRequestWarning) + esmfold_apiquery(input_file, output_file) # check if called from interpreter