from flask import request, Blueprint from flask_restful import Resource, Api from os import path, makedirs import logging from bs4 import BeautifulSoup from models.config import CONTENT_DIR from models.utils import read_line_md, gen_md_file_dirs, translate, get_now_time from models.store_locations.templates import store_location_template, amp_img_template from models.store_locations import STORE_CONTENT_DIR from models.statics.routes import get_static_imgs_src store_locations_app = Blueprint('store_locations', __name__) logger = logging.getLogger(__name__) api = Api(store_locations_app) class StoreLocations(Resource): def __init__(self): self.exist_img_file_src = [] def get_file_data(self, f_dir): result = {} is_amp_img = False for line in read_line_md(f_dir): if 'title: ' in line: result['title'] = line.split('title: ')[-1].replace('"', '').replace('\n', '') elif 'type: ' in line: result['type'] = line.split('type: ')[-1].replace('"', '').replace('\n', '') elif '