Example #1
0
 def name(self, data):
     information = {}
     if len(data) > 0:
         for i, singledata in enumerate(data):
             number = singledata["penDecNo"]
             if "illegActType" in singledata.keys():
                 types = singledata["illegActType"]
             elif "illegAct" in singledata.keys():
                 types = singledata["illegAct"]
             content = singledata["penPunishCon"]
             date = singledata["penDecissDate"]
             date = deal_html_code.change_chinese_date(date)
             # updateDate = singledata["updateDate"]
             pub_date = '0000-00-00'
             pdfurl = singledata["penFilePath"]
             name = singledata["illegPt"]
             gov_dept = singledata["penOrgan"]
             regNo = singledata["regNo"]
             if "uniScid" in singledata.keys():
                 uniScid = singledata["uniScid"]
                 provin = deal_html_code.judge_province(uniScid)
             else:
                 provin = deal_html_code.judge_province(regNo)
             pdfurl = pdf_path[provin] % pdfurl
             information[i] = [
                 number, types, content, date, name, gov_dept, pdfurl,
                 pub_date
             ]
     return information
Example #2
0
def get_index(code):
    province = deal_html_code.judge_province(code)
    first_url = config.url_list[province].format(code)
    result,status_code = Send_Request().send_requests(first_url)
    data = None
    if status_code ==200:
        info = json.loads(result)["info"][0]
        uuid = info["uuid"]
        second_url = config.detail_list[province].format(uuid)
        data = Send_Request().send_requests(second_url)[0]
    return data
Example #3
0
def insert_to_basic(information,cursor,connect):
	entName = information[0][0]
	code = information[0][1]
	ccode = information[0][2]
	legal_person = information[0][3]
	dates = information[0][4]
	status = information[0][5]
	if code!=None and code!='':
		province = deal_html_code.judge_province(code)
	elif ccode!=None and ccode!='':
		province = deal_html_code.judge_province(code)
	m = hashlib.md5()
	m.update(code)
	id = m.hexdigest()
	updated = deal_html_code.get_befor_date()
	# updated = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
	cursor.execute(insert_string, ((id, province, entName, code, ccode, legal_person, dates, status, updated)))
	gs_basic_id = connect.insert_id()
	connect.commit()
	return gs_basic_id
Example #4
0
 def name(self, data):
     information = {}
     for i, singledata in enumerate(data):
         # nodeNum = singledata["nodeNum"]
         ia_zch = singledata["regNum"]
         if "intCls" in singledata.keys():
             ia_flh = singledata["intCls"]
         else:
             ia_flh = ''
         if "regAnncIssue" in singledata.keys():
             ia_zcgg = singledata["regAnncIssue"]
         else:
             ia_zcgg = ''
         if "goodsCnName" in singledata.keys():
             ia_servicelist = deal_html_code.remove_symbol(
                 singledata["goodsCnName"])
         else:
             ia_servicelist = ''
         if "propertyBgnDate" in singledata.keys():
             begin = singledata["propertyBgnDate"]
             begin = deal_html_code.change_chinese_date(begin)
         else:
             begin = ''
         if "propertyEndDate" in singledata.keys():
             end = singledata["propertyEndDate"]
             end = deal_html_code.change_chinese_date(end)
         else:
             end = ''
         if "uniScid" in singledata.keys():
             regNo = singledata["uniScid"]
         else:
             regNo = singledata["regNo"]
         province = judge_province(regNo)
         if begin == '' and end == '':
             ia_zyqqx = ''
         else:
             ia_zyqqx = begin + '至' + end
         if "regAnncDate" in singledata.keys():
             ia_zcdate = singledata["regAnncDate"]
             ia_zcdate = deal_html_code.change_chinese_date(ia_zcdate)
         else:
             ia_zcdate = ''
         if "tmImage" in singledata.keys():
             tmImage = singledata["tmImage"]
         else:
             tmImage = ''
         information[i] = [
             ia_zch, ia_flh, ia_zcgg, ia_servicelist, ia_zyqqx, ia_zcdate,
             province, tmImage
         ]
     return information
Example #5
0
def get_index(code):
    province = deal_html_code.judge_province(code)
    first_url = config.url_list[province].format(code)
    #print first_url
    result= requests.get(first_url)
    status_code = result.status_code
    result = result.content
    second_url = None
    entName = None
    if status_code ==200:
        info = json.loads(result)["info"]
        if len(info)!=0:
            info = json.loads(result)["info"][0]
            uuid = info["uuid"]
            entName = info["entName"]
            second_url = config.detail_list[province].format(uuid)
            flag = 1
        else:
            flag = 100000003
    else:
        flag = 100000001
    return second_url,flag,entName
Example #6
0
def get_all_info(cursor,connect,gs_basic_id):
    province = deal_html_code.judge_province(code)
    data = get_index(code)
    data_list = get_info_list(data)
    # basicinfo = App_basic.name(data)
    # App_basic.update_to_db(cursor, connect, gs_basic_id, basicinfo)
    # branchinfo = data_list["branch"]
    # branchinfo = App_branch.name(branchinfo)
    # App_branch.update_to_db(cursor,connect,gs_basic_id,branchinfo)
    # brandinfo = data_list["brand"]
    # brandinfo = App_brand.name(brandinfo)
    # App_brand.update_to_db(cursor,connect,gs_basic_id,brandinfo)
    # changeinfo = data_list["change"]
    # changeinfo = App_change.name(changeinfo)
    # App_change.update_to_db(cursor,connect,gs_basic_id,changeinfo)
    # clearinfo = data_list["clear"]
    # clearinfo = App_clear.name(clearinfo)
    # App_clear.update_to_db(cursor,connect,gs_basic_id,clearinfo)
    # exceptinfo = data_list["except"]
    # exceptinfo = App_except.name(exceptinfo)
    # App_except.update_to_db(cursor,connect,gs_basic_id,exceptinfo)
    # freezeinfo = data_list["freeze"]
    # freezeinfo = App_freeze.name(freezeinfo,province)
    # App_freeze.update_to_db(cursor,connect,gs_basic_id,freezeinfo)
    # mortinfo = data_list["mort"]
    # mortinfo = App_mort.name(mortinfo,province)
    # App_mort.update_to_db(gs_py_id,cursor,connect,gs_basic_id,mortinfo)
    # permitinfo = data_list["permit"]
    # permitinfo = App_permit.name(permitinfo)
    # App_permit.update_to_db(cursor,connect,gs_basic_id,permitinfo)
    # personinfo = data_list["person"]
    # personinfo = App_person.name(personinfo)
    # App_person.update_to_db(cursor,connect,gs_basic_id,personinfo)
    punishinfo = data_list["punish"]

    punishinfo = App_punish.name(punishinfo)
    App_punish.update_to_db(cursor, connect, gs_basic_id, punishinfo)