This commit is contained in:
2025-11-21 01:26:38 +08:00
parent 14aef04d1b
commit 1c519fe681
2 changed files with 31 additions and 25 deletions

View File

@@ -59,28 +59,34 @@ class Api:
return None return None
return response return response
# def main(): def main():
# """ """
# 从同目录的 `bakeries.csv` 读取面包店数据,按列映射输出或创建店铺 从同目录的 `bakeries.csv` 读取面包店数据,按列映射输出或创建店铺
# 列顺序:`Name,Address,City` 列顺序:`Name,Address,City`
# """ """
# api = Api() api = Api()
# csv_path = os.path.join(os.path.dirname(__file__), 'bakeries.csv') csv_path = os.path.join(os.path.dirname(__file__), 'bakeries.csv')
# if not os.path.exists(csv_path): if not os.path.exists(csv_path):
# logger.error(f'CSV 文件不存在: {csv_path}') logger.error(f'CSV 文件不存在: {csv_path}')
# return return
# with open(csv_path, 'r', encoding='utf-8') as file: with open(csv_path, 'r', encoding='utf-8') as file:
# reader = csv.reader(file) reader = csv.reader(file)
# header = next(reader, None) header = next(reader, None)
# for row in reader: for row in reader:
# if len(row) < 3: if len(row) < 3:
# logger.warning(f'行列数不足,跳过: {row}') logger.warning(f'行列数不足,跳过: {row}')
# continue continue
# shop_name, street, city = row[0], row[1], row[2] shop_name, street, city = row[0], row[1], row[2]
# logger.info(f'city: {city}, street: {street}, shop_name: {shop_name}') if ' (city)' in city:
# api.create_shop(city, street, shop_name) city = city.replace(' (city)', '')
if 'Quebec' in city:
continue
if ',' in city:
city = city.split(',')[0]
logger.info(f'city: {city}, street: {street}, shop_name: {shop_name}')
api.create_shop(city, street, shop_name)
# def main2(): # def main2():
# api = Api() # api = Api()

View File

@@ -380,15 +380,15 @@ class Auto:
# 取对应城市的代理 # 取对应城市的代理
def get_proxy( city: str): def get_proxy( city: str):
if city == "Calgary": if city == "Calgary":
return "us.novproxy.io:1000:uwqr8065-region-CA-st-Alberta-city-Calgary:d6vqwerx".split(':') return "us.novproxy.io:1000:ozua8623-region-CA-st-Alberta-city-Calgary:6wdcv4gq".split(':')
elif city =='Edmonton': elif city =='Edmonton':
return 'us.novproxy.io:1000:uwqr8065-region-CA-st-Alberta-city-Edmonton:d6vqwerx'.split(':') return 'us.novproxy.io:1000:ozua8623-region-CA-st-Alberta-city-Edmonton:6wdcv4gq'.split(':')
elif city =='Vancouver': elif city =='Vancouver':
return 'us.novproxy.io:1000:uwqr8065-region-CA-st-British Columbia-city-Vancouver:d6vqwerx'.split(':') return 'us.novproxy.io:1000:ozua8623-region-CA-st-British Columbia-city-Vancouver:6wdcv4gq'.split(':')
elif city =='Halifax': elif city =='Halifax':
return 'us.novproxy.io:1000:uwqr8065-region-CA-st-Nova Scotia-city-Halifax:d6vqwerx'.split(':') return 'us.novproxy.io:1000:ozua8623-region-CA-st-Nova Scotia-city-Halifax:6wdcv4gq'.split(':')
elif city == 'Toronto': elif city == 'Toronto':
return 'us.novproxy.io:1000:uwqr8065-region-CA-st-Ontario-city-Toronto:d6vqwerx'.split(':') return 'us.novproxy.io:1000:ozua8623-region-CA-st-Ontario-city-Toronto:6wdcv4gq'.split(':')
else: else:
return None return None