feat: faker data: identification
This commit is contained in:
17
app.py
17
app.py
@@ -2,25 +2,26 @@ from flask import Flask
|
||||
import config
|
||||
import utils.response as response
|
||||
import service.faker_data as faker
|
||||
# from base import db
|
||||
from model import Person
|
||||
from base import db
|
||||
from model import Person, SexEnum
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(config)
|
||||
config.init_config(app)
|
||||
db.init_app(app)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def hello_world(): # put application's code here
|
||||
print(SexEnum(1).sex)
|
||||
return 'Hello World!'
|
||||
|
||||
|
||||
@app.route("/faker")
|
||||
def faker_data():
|
||||
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({})
|
||||
persons = faker.store_faker_identification(1)
|
||||
results = [person.__to_dict__() for person in persons]
|
||||
# return response.succ(persons)
|
||||
return response.succ(faker.faker_train(3))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user