def test_getjson(self): gd = glassdoor.parse(glassdoor.get('dropbox')) try: self.assertTrue(all([k in gd.keys() for k in stdkeys]), 'Missing Keys') except Exception as e: raise Exception('GETjson failed: %s' % e)
def test_getjson(self): g = glassdoor.get('dropbox') print g try: self.assertTrue(all([k in g.keys() for k in stdkeys]), 'Missing Keys') except Exception as e: raise Exception('GETjson failed: %s' % e)
def main(): response = get('dropbox') print response print '-' * 100 for key, value in response.iteritems(): print "(%s: %s)" % (key, value) print '-' * 100 (satisfaction, ceo, meta, salary) = extract_fields(response) (numRatings, score) = extract_satisfaction(satisfaction) (numCEOReviews, approvalRate, name, avatarLink) = extract_ceo(ceo) print "numRatings: %d, score: %d" % (numRatings, score) print "numCEOReviews: %d, approvalRate: %d, name: %s" % (numCEOReviews, approvalRate, name)
def main(): response = get('dropbox') print response print '-' * 100 for key, value in response.iteritems(): print "(%s: %s)" % (key, value) print '-' * 100 (satisfaction, ceo, meta, salary) = extract_fields(response) (numRatings, score) = extract_satisfaction(satisfaction) (numCEOReviews, approvalRate, name, avatarLink) = extract_ceo(ceo) print "numRatings: %d, score: %d" % (numRatings, score) print "numCEOReviews: %d, approvalRate: %d, name: %s" % ( numCEOReviews, approvalRate, name)
def convert_facebook_data_to_salary_category(user_data): employer_glassdoor_data = get(user_data['employer']) salary = attempt_get_role_mean_salary(user_data['title'], employer_glassdoor_data) if salary is not None: print "mean salary of role: " + str(salary) print "your friend is " + salary_to_category(salary) else: company_salary = attempt_get_company_mean_salary(employer_glassdoor_data) if company_salary is not None: print "mean salary of company: " + str(company_salary) print "your friend is probably " + salary_to_category(company_salary) else: print "not enough data is available on your friend" print ""
def glassdoor_get_company_details(): count = 0 fp = open('company_list.txt','r') for line in fp: try: x = get(line) x = x.json() result = json.loads(x) except: continue try: if result.get('satisfaction',None): count +=1 title = "company1/"+str(count)+'.json' f = open(title,'w') f.write(json.dumps(result)) f.close() except: print ':(' print traceback.format_exc()
def glassdoor_get_company_details(): count = 0 fp = open('company_list.txt', 'r') for line in fp: try: x = get(line) x = x.json() result = json.loads(x) except: continue try: if result.get('satisfaction', None): count += 1 title = "company1/" + str(count) + '.json' f = open(title, 'w') f.write(json.dumps(result)) f.close() except: print ':(' print traceback.format_exc()
def job_details(): user = User.query.filter_by(id=session['user_id']).first() if request.method == 'GET': url = request.args.get('joburl') company = request.args.get('company') x = get('dropbox') print x job_response = urllib2.urlopen(url).read() p = LinksParser() p.feed(job_response) p.close() url = 'http://access.alchemyapi.com/calls/text/TextGetRankedConcepts' apikey = '6e2ca8f176761b589a9bee72a3ff6ed8703e0706' #your API key goes here params = urllib.urlencode({ 'apikey': apikey, 'text': p.data, 'showSourceText': '0', #shows the original text sent to the API }) alchemyThis = urllib2.urlopen(url, params).read() xmldoc = minidom.parseString(alchemyThis) nodes = xmldoc.getElementsByTagName('concept') all = list() for node in nodes: textVal = node.getElementsByTagName('text')[0] rel = node.getElementsByTagName('relevance')[0] dbpedia = node.getElementsByTagName('dbpedia')[0] concept = (textVal.childNodes[0].data, rel.childNodes[0].data, dbpedia.childNodes[0].data) all.append(concept) #print job_response return render_template("job_details.html", title="Job Analysis", job_des=p.data, concepts=all, user=user)
def job_details(): user=User.query.filter_by(id=session['user_id']).first() if request.method == 'GET': url=request.args.get('joburl') company=request.args.get('company') x = get('dropbox') print x job_response = urllib2.urlopen(url).read() p = LinksParser() p.feed(job_response) p.close() url = 'http://access.alchemyapi.com/calls/text/TextGetRankedConcepts' apikey = '6e2ca8f176761b589a9bee72a3ff6ed8703e0706' #your API key goes here params = urllib.urlencode({ 'apikey': apikey, 'text': p.data, 'showSourceText': '0', #shows the original text sent to the API }) alchemyThis = urllib2.urlopen(url, params).read() xmldoc = minidom.parseString(alchemyThis) nodes = xmldoc.getElementsByTagName('concept') print "hello ",p.data all = list() for node in nodes: textVal = node.getElementsByTagName('text')[0] rel = node.getElementsByTagName('relevance')[0] dbpedia = node.getElementsByTagName('dbpedia')[0] concept = (textVal.childNodes[0].data, rel.childNodes[0].data, dbpedia.childNodes[0].data) all.append(concept) #print job_response return render_template("job-histogram.html", title = "Job Analysis", job_des = p.data, concepts = all, user=user)
import json from glassdoor import get dest_path = 'company.json' json_data = open('companies/data.json') data = json.load(json_data) com_list = [] for value in data: com_list.append(value['name']) json_data.close() #remove duplicates com_list = list(set(com_list)) print 'Len: ', len(com_list) obj = open(dest_path, 'w') obj.write('[') for one in com_list: info = get(one) obj.write('{ name:' + one + ',') obj.write(json.dumps(info)) obj.write('},') obj.flush() obj.write(']') obj.close()
#-*- coding: utf-8 -*- import json from glassdoor import get dest_path = 'company90000.json' json_data = open('companies/data.json') data = json.load(json_data) com_list = [] for value in data: com_list.append(value['name']) json_data.close() #remove duplicates com_list = list(set(com_list)) print 'Len: ', len(com_list) obj = open(dest_path, 'w') obj.write('[') com_short = com_list[90000:] print 'new len: ', len(com_short) for one in com_short: #print one info = get(one) obj.write('{ "name": "' + one.encode('utf-8') +'",') obj.write(' "info": ' + json.dumps(info)) obj.write('},\n') obj.flush() obj.write(']') obj.close()
def test_getjson(self): gd = glassdoor.parse(glassdoor.get("dropbox")) try: self.assertTrue(all([k in gd.keys() for k in stdkeys]), "Missing Keys") except Exception as e: raise Exception("GETjson failed: %s" % e)
from glassdoor import get x = get('dropbox') x.json()