fix: change project struct

This commit is contained in:
Zhaolong
2022-01-25 22:57:24 +08:00
parent 3be9b86fff
commit da9965e2ae
10 changed files with 166 additions and 19 deletions

26
app.py
View File

@@ -1,11 +1,12 @@
from flask import Flask
from faker import Faker
import requests
from lxml import etree
import config
import utils.response as response
import service.faker_data as faker
# from base import db
from model import Person
app = Flask(__name__)
app.config.from_object(config)
@app.route('/')
@@ -15,20 +16,11 @@ def hello_world(): # put application's code here
@app.route("/faker")
def faker_data():
# for i in range(2):
# identification = faker.ssn(max_age=70)
# resp = requests.get("https://shenfenzheng.bmcx.com/" + identification + "__shenfenzheng/")
# html = etree.HTML(resp.text)
# infos = html.xpath('//table[@width="100%"]//tr[position()!=2]/td[@bgcolor="#FFFFFF"]//text()')
# result = {
# 'identification': infos[0],
# 'originArea': infos[1],
# 'sex': infos[3][0],
# 'name': faker.last_name() + (faker.first_name_male() if infos[3][0] == '男' else faker.first_name_female()),
# 'age': infos[4][0:-2]
# }
# faker_datas.append(result)
return response.succ(faker.faker_identifications(50))
datas = faker.faker_identifications(2)
print(datas[0])
print(Person.__dict__.update(datas[0]))
# persons = [Person.__dict__.update(datas[index]) for index in range(len(datas))]
return response.succ({})
if __name__ == '__main__':