Exemplo n.º 1
0
    def extract_jobleads_from_feed(self, xmlsoup, search_engine_url_parameter, software_name):


        # TODO This part needs to be broken down and fed into a message queue
        for result in xmlsoup.find_all('result'):

            snippet_encoded = stringutils.cleanCypherString(result.snippet.text)

            lead_exists_bool, leadnode = LeadNode.lead_exists(snippet_encoded)

            if not lead_exists_bool:

                leadnode = LeadNode.write_lead_node(company = result.company.text,
                                             city = result.city.text,
                                             state = result.state.text,
                                             country = result.country.text,
                                             url = result.url.text,
                                             date = result.date.text,
                                             jobtitle = result.jobtitle.text,
                                             snippet = snippet_encoded,
                                             search_engine_url = search_engine_url_parameter,
                                             software = software_name,
                                             version = "1.0",
                                             type = "LEAD")



            branch_exists_bool, results = BranchNode.branch_exists(result.company.text, result.city.text, result.state.text)


            if not branch_exists_bool:

                branch_node = BranchNode.write_branch_node( leadnode,
                                                            company = result.company.text,
                                                            city = result.city.text,
                                                            state = result.state.text,
                                                            country = result.country.text,
                                                            discovered_by_us = datetime.datetime.now().strftime("%m/%d/%Y %H:%M:%S:%f"))

                CompanyNode.write_company_node(branch_node)




        return
Exemplo n.º 2
0
    def write_contact_for_company(self, company_name, **kargs):

        company_exists_bool, company_node =  CompanyNode.company_exists(company_name)

        if company_exists_bool:
            contact_node = ContactNode.write_contact_node(company_node, **kargs)
        else:
            contact_node = None

        return contact_node