import pymysql
import os
import json

scripts_path = r'C:/Users/Fenoglia/Downloads/cmip6-scripts'
EOF_FLAG_STR = 'EOF--dataset.file.url.chksum_type.chksum'
if __name__ == '__main__':
    db = pymysql.connect(host='39.101.194.63', port=23306,
                         user='root', passwd='passok123A', db='jd_data', charset='utf8mb4')
    cursor = db.cursor()
    SQL_SELECT = "SELECT url FROM jd_data.cmip6_search_result WHERE id IS NOT NULL "
    cursor.execute(SQL_SELECT)
    for line in cursor.fetchall():
        url = line[0]
        if url:
            if url.startswith("http"):
                print(url)
            else:
                print(json.loads(url)[0])
    db.close()
