36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from flask import Flask
|
|
from faker import Faker
|
|
import requests
|
|
from lxml import etree
|
|
import utils.response as response
|
|
import service.faker_data as faker
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
@app.route('/')
|
|
def hello_world(): # put application's code here
|
|
return 'Hello World!'
|
|
|
|
|
|
@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))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run()
|