feat: faker data: identification
This commit is contained in:
24
app.py
24
app.py
@@ -1,6 +1,9 @@
|
||||
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__)
|
||||
|
||||
@@ -12,12 +15,21 @@ def hello_world(): # put application's code here
|
||||
|
||||
@app.route("/faker")
|
||||
def faker_data():
|
||||
faker = Faker(["zh_CN"])
|
||||
result = ""
|
||||
for i in range(1):
|
||||
identification = faker.ssn()
|
||||
resp = requests.get("https://shenfenzheng.bmcx.com/" + identification + "__shenfenzheng/")
|
||||
print(resp.text)
|
||||
# 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()
|
||||
|
||||
Reference in New Issue
Block a user