fix: change project struct
This commit is contained in:
26
app.py
26
app.py
@@ -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__':
|
||||
|
||||
Reference in New Issue
Block a user