def post(self):
     company = Company()
     company.name = self.GetParam("name")
     company.industry = self.GetParam("industry")
     company.url = self.GetParam("url")
     company.put()
     self.redirect("/companies/view/" + company.urlname)
Beispiel #2
0
def get_ftse_companies(url):
    companies = []
    table = pd.read_html(url)[3]
    for index, row in table.iterrows():
        company = Company(row['EPIC'])
        company.name = row['Company']
        company.sector = row[
            'FTSE Industry Classification Benchmark sector[12]']
        companies.append(company)
    return companies
Beispiel #3
0
    def post(self):
            newCompany = Company()
            newCompany.name = self.request.get("name")
            newCompany.cgpa = self.request.get("cgpa")
            newCompany.desc = self.request.get("desc")
            newCompany.sal = self.request.get("sal")
            newCompany.date = self.request.get("date")
            newCompany.lastDate = self.request.get("lastDate"); 
            newCompany.put()
	    self.redirect("/admin")       
Beispiel #4
0
def get_snp_500_companies(url):
    companies = []
    table = pd.read_html(url)[0]
    for index, row in table.iterrows():
        company = Company(row['Symbol'])
        company.name = row['Security']
        company.sector = row['GICS Sector']
        company.industry = row['GICS Sub Industry']
        company.date_added = row['Date first added']
        companies.append(company)
    return companies
Beispiel #5
0
 def post(self):
    if(Company.exists(request.form['name'])):
       return jsonify(message='Company exists')
    else:
       company = Company()
       company.name = request.form['name']
       company.tin = request.form['tin']
       company.address = request.form['address']
       db.session.add(company)
       db.session.commit()
       return jsonify(company.serialize)
Beispiel #6
0
 def save_instance_form(self, form, user):
     company = Company()
     company.nit = form.cleaned_data['nit']
     company.name = form.cleaned_data['name']
     company.location = form.cleaned_data['location']
     company.website = form.cleaned_data['website']
     company.email = form.cleaned_data['email']
     company.phone = form.cleaned_data['phone']
     company.save()
     user.company = company
     user.save()
Beispiel #7
0
def input_companies():
  ''' Creates the company models for each S&P 500 company'''
  
  yahoo_data = yahooDataRetriever.get_dict_500_companies(name_file)
  
  for i in yahoo_data.keys():
    if len(Company.objects.filter(ticker = i)) > 0:
      continue
    c = Company()
    c.name = yahoo_data.get(i)
    c.ticker = i
    c.save()
    print "## Saved Company Object for: " + i
    def save_company(self, tree):
        company = Company()
        
        #company introduction
        l = tree.xpath('//div[contains(@class, \'jobs_txt\')]/p')
        #print "company introduction:"
        for i in l:
            if not i.text is None:
                #print i.text
                company.introduction = i.text


        #company name
        l = tree.xpath('//td[@class=\'sr_bt\']')
        for i in l:
            tr = l[0].getparent()
            print "company name:"
            iters = tr.itersiblings(); 
            for it in iters: 
                a_list = it.xpath('//td/table/tr/td/a')
                for i in a_list:
                    if not i.text is None:
                        #print i.text
                        company.name = i.text
                break
            break

        #company info
        l = tree.xpath('//td/strong')
        txt1_tag = ['公司行业:', '公司性质:', '公司规模:' ]

        remove_from_list(l, txt1_tag)
        for i in l:
            td = i.getparent()
            iters = td.itertext()
            index = 0
            for it in iters:
                it = it.lstrip()
                if it in txt1_tag:
                    continue
                if index == 0:
                    company.industry = it
                elif index == 1:
                    company.nature = it
                elif index == 2:
                    company.scale = it
                index += 1
                #print "[%s]" % it.lstrip()
            break

        company.save()
Beispiel #9
0
def create_company():
    search_form = SearchForm()
    form = CreateCompanyForm()
    if request.method == "POST":
        comp_obj = Company()
        comp_obj.name = form.company_name.data
        db.session.add(comp_obj)
        db.session.commit()
        flash("Create company success")
        return render_template("create_company.html", search_form=search_form, form=form)
    else:
        if current_user.role != 3:
            flash("You have no permission")
            return redirect(url_for("main"))
        return render_template("create_company.html", search_form=search_form, form=form)
Beispiel #10
0
    def post(self):
        company = Company()

        try:
            name = self.request.get('name') 
            company.name = name
        except:
            pass

        try:
            address = self.request.get('address') 
            company.address = address
        except:
            pass

        try:
            city = self.request.get('city') 
            company.city = city
        except:
            pass

        try:
            country = self.request.get('country') 
            company.country = country
        except:
            pass

        try:
            email = self.request.get('email') 
            company.email = email
        except:
            pass

        try:
            phone_number = int(self.request.get('phone_number'))
            company.phone_number = phone_number
        except:
            pass

        company.put()

        company_id = company.key().id()

        self.redirect("company/" + str(company_id))
Beispiel #11
0
def getCompanyInfo(dom):
    '''获取一个公司的信息'''
    info_items = dom('.companyInfoItems')
    info_trs = info_items('.companyInfoTab tr')
    

    company_info = {}
    for tr in info_trs:
        tr = pq(tr)
        k = tr('td:eq(0)').text().split(u':')[0]
        v = tr('td:eq(1)').text()
        company_info[k] = v

    scale = company_info.get(u'公司规模')
    if scale:
        sh = re.search(r'(\d+)-(\d+)', scale)
        scale = sh.groups() if sh else (None, None)
    else:
        scale = (None, None)

    ####
    jcs = dom('.jobContact>div>div').find('div') # Job Contact
    for jc in jcs:
        jc = pq(jc)
        jctext = jc.text().split(u':')
        if len(jctext) == 2:
            k, v = jctext
            company_info[k] = v 

    com = Company()
    com.name = info_items('.companyTitle').text()
    com.industry = company_info.get(u'公司行业')
    com.type = company_info.get(u'公司类型')
    com.address = company_info.get(u'公司地址')
    com.website = company_info.get(u'公司主页')
    com.scale_low, com.scale_high = scale
    com.email = None
    com.phone_num = None
    com.description = dom('.black12 tr:eq(2)').find('td').html()
    com.etag = ''

    return com
Beispiel #12
0
def getCompanyInfo(dom):
    '''获取一个公司的信息'''
    info_items = dom('.companyInfoItems')
    info_trs = info_items('.companyInfoTab tr')

    company_info = {}
    for tr in info_trs:
        tr = pq(tr)
        k = tr('td:eq(0)').text().split(u':')[0]
        v = tr('td:eq(1)').text()
        company_info[k] = v

    scale = company_info.get(u'公司规模')
    if scale:
        sh = re.search(r'(\d+)-(\d+)', scale)
        scale = sh.groups() if sh else (None, None)
    else:
        scale = (None, None)

    ####
    jcs = dom('.jobContact>div>div').find('div')  # Job Contact
    for jc in jcs:
        jc = pq(jc)
        jctext = jc.text().split(u':')
        if len(jctext) == 2:
            k, v = jctext
            company_info[k] = v

    com = Company()
    com.name = info_items('.companyTitle').text()
    com.industry = company_info.get(u'公司行业')
    com.type = company_info.get(u'公司类型')
    com.address = company_info.get(u'公司地址')
    com.website = company_info.get(u'公司主页')
    com.scale_low, com.scale_high = scale
    com.email = None
    com.phone_num = None
    com.description = dom('.black12 tr:eq(2)').find('td').html()
    com.etag = ''

    return com
Beispiel #13
0
 def test_safestr(self):
     c = Company(cents_payed=12, products_delivered=1)
     c.name = SafeUnicode(u"Iñtërnâtiônàlizætiøn1")
     c.save()
     c.name = SafeString(u"Iñtërnâtiônàlizætiøn1".encode("utf-8"))
     c.save()
Beispiel #14
0
 def test_safestr(self):
     c = Company(cents_payed=12, products_delivered=1)
     c.name = SafeUnicode(u'Iñtërnâtiônàlizætiøn1')
     c.save()
     c.name = SafeString(u'Iñtërnâtiônàlizætiøn1'.encode('utf-8'))
     c.save()
Beispiel #15
0
def read_job_from_html(skill, html_file):
    """
    read job info from downloaded html file
    :param html_file: contains job info, but sometime the contents are empty.
    """
    html = read_all(html_file)
    soup = make_soup(html)
    detail = soup.find('dl', 'job_detail')

    # in some rare cases, e.g. the job is closed already, then the job info is missing.
    if not detail:
        return None

    job = Job()

    job.job_id = int(soup.find('input', {'id': 'jobid'})['value'])
    job.skill_tag = skill

    log('*** JOB ***')
    title = detail.find('h1')
    log(title['title'])
    log(title.div.text)

    job.title = title['title']
    job.dept = title.div.text

    log('')
    request = detail.find('dd', 'job_request')
    main_features = []
    for s in request.stripped_strings:
        f = s.strip().lstrip(u'职位诱惑 : ').lstrip(u'发布时间:').rstrip(u'发布')
        log(f)
        main_features.append(f)

    assert len(main_features) == 7
    job.salary = main_features[0]
    job.city = main_features[1]
    job.experience = main_features[2]
    job.education = main_features[3]
    job.full_time = main_features[4] == u'全职'
    job.benefits = main_features[5]
    job.published_date = get_published_date(main_features[6], created_on(html_file))

    log('')
    desc_html = []
    desc = detail.find('dd', 'job_bt').find_all('p')
    for bt in desc:
        desc_html.append(unicode(bt))
    job.desc = ''.join(desc_html)
    log(job.desc)

    log('\n*** COMPANY ***\n')
    company = Company()

    comp = soup.find('dl', 'job_company')
    url = comp.dt.a['href']
    pat = re.compile(r'(?P<comp_id>\d+)')
    m = re.search(pat, url)
    log(url)
    company.comp_id = int(m.group('comp_id'))
    job.comp_id = company.comp_id

    log(comp.dt.a.img['src'])
    log(comp.dt.a.div.h2.text.split()[0])
    company.logo = comp.dt.a.img['src']
    company.name = comp.dt.a.div.h2.text.split()[0]

    log('')
    comp_features = comp.dd
    features = []
    for li in comp_features.ul.find_all('li'):
        for ls in li.stripped_strings:
            features.append(ls)

    log(''.join(features))
    if len(features) == 6:
        company.domain = features[1]
        company.size = features[3]
        company.url = features[5]
    else:
        print(u'features ex: ' + html_file)

    log('')
    stage_h = comp_features.h4
    stage_tags = stage_h.find_next_sibling('ul').find_all('li')
    stage = []
    for li in stage_tags:
        for ls in li.stripped_strings:
            stage.append(ls)
    log('\t'.join(stage))
    if len(stage) % 2 == 0:
        for i in xrange(0, len(stage), 2):
            if stage[i] == u'目前阶段':
                company.cur_stage = stage[i + 1]
            elif stage[i] == u'投资机构':
                company.investor = stage[i + 1]
    else:
        print(u'stages ex: ' + html_file)

    log('')
    # address
    if comp_features.div:
        log(comp_features.div.text)
        company.address = comp_features.div.text

    return job, company
from models import Company, database

alelo = Company()
alelo.name = "ALELO"
alelo.description = "Cartão Refeição, Alimentação. A gente trabalha em seu benefício."
alelo.base_value = 30
alelo.picture = "http://www.appsgalery.com/pictures/000/150/-lelo-150898.png"

sodexo = Company()
sodexo.name = "SODEXO"
sodexo.description = "Motive ainda mais os seus trabalhadores! Com os cartões de benefícios para funcionários da Sodexo, eles ganham benefícios e vantagens exclusivas!"
sodexo.base_value = 25
sodexo.picture = "http://freevectorlogo.net/wp-content/uploads/2012/10/sodexo-vector-logo-400x400.png"

vr = Company()
vr.name = "VR"
vr.description = "A refeição saborosa dos funcionários ainda traz benefícios fiscais para a sua empresa!"
vr.base_value = 28
vr.picture = "http://merkk.com/wp-content/uploads/2015/12/vr-refei----o.png"

with database.transaction():
	alelo.save()
	sodexo.save()
	vr.save()