diff --git a/.gitignore b/.gitignore index 47771b9..42f4ce0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ html/ .DS_Store venv -*.pyc \ No newline at end of file +*.pyc +*~* +*#* \ No newline at end of file diff --git a/request.py b/request.py index d20308a..2fa08c2 100644 --- a/request.py +++ b/request.py @@ -8,23 +8,23 @@ import requests def get_session(email, password, host='https://www.hackerschool.com'): - s = requests.session() - #host = 'http://localhost:5000' - # This request is to get the CSRF token (the point of which is to make sure other websites - # can't make requests on your behalf I think, something to with cross-site scripting - # http://en.wikipedia.org/wiki/Cross-site_request_forgery - r = s.get(host+'/login', verify=False) - m = re.search(r' r2: + ratio += r2 + else: + ratio += r1 + + # sum of ratios, per person + weight_sums[person] += ratio + + # how the person's name will appear on the page + person_data['name'] = (person + + " (" + + str(ratio)[:5] + + ")" ) + # add this entry to the people per keyword + kw_data['children'].append(person_data) + + # add this keyword's data to the tree + match_data['children'].append(kw_data) + + # select the person with the highest score + match_data['top'] = max(weight_sums, key=weight_sums.get) + + # dump it return json.dumps(match_data) if __name__ == '__main__': port = int(os.environ.get('PORT', 80)) - app.run(host='0.0.0.0', port=port) + app.run(host='127.0.0.1', port=port)