Skip to content

Instantly share code, notes, and snippets.

@mstepniowski
Last active December 10, 2015 22:31
Show Gist options
  • Save mstepniowski/4502077 to your computer and use it in GitHub Desktop.
Save mstepniowski/4502077 to your computer and use it in GitHub Desktop.
Script showing top 25 talk proposals for DjangoCon Europe 2013
# 25 best talk proposals as of Saturday, 19th of January at 11:59 PM UTC
# ----------------------------------------------------------------------
# Calculated by votes.py from 15383 votes of 790 people.
1. (411) Asynchronous code in Django.
2. (398) How to combine JavaScript & Django in a smart way
3. (375) Website security in Django
4. (364) Advanced PostgreSQL in Django
5. (359) Designing a good API: Lessons Learned
6. (344) Let’s bankrupt Heroku: make your Django run fast
7. (335) Caching Django
8. (310) Taming Ajax and Django
9. (310) The path to Continuous Deployment
10. (308) Single page web applications with Django
11. (302) Linux process management -- you're doing it wrong
12. (300) Advanced Python through Django: Metaclasses
13. (300) Working smart with Django (so you don't have to work hard)
14. (295) Does your shit scale?
15. (292) Mock your database
16. (285) Why Django sucks
17. (284) A Frontend Framework for the Django Admin Interface
18. (282) Django on Amazon Web Services
19. (281) Taming multiple databases with Django
20. (272) Administrative Interfaces
21. (271) Real-time Web Applications with Mushroom
22. (262) Speed up your Django apps with Jython and SPDY
23. (257) Apps for advanced plans, pricings, billings and payments in Django
24. (250) Dynamic Models in Django
25. (249) Enterprise Django: transactions for web developers
#!/usr/bin/env python
#
# Script showing top 25 talk proposals for DjangoCon Europe 2013
# --------------------------------------------------------------
#
# You're allowed to see number of votes for a given talk proposal only
# after you've voted for this proposal. To see the same numbers you see,
# this script needs your SESSIONID. Set it below.
#
# Requirements: requests, lxml
#
import requests
from lxml import html
# Value of your sessionid cookie, used to get votes of talks you've voted for
SESSIONID = "a098be... nope, AIN'T TELLING!"
# Name of your favourite talk, will be shown in COLOR
TALKNAME = "TITLE OF MY AMAZING TALK (it's a secret!)"
# Count of top talk proposals to show
LIMIT = 25
COLOR = '\033[1;34m'
END = '\033[0m'
r = requests.get('http://2013.djangocon.eu/vote/',
cookies={'sessionid': SESSIONID})
document = html.document_fromstring(r.text)
entries = [(entry.xpath('div[@class="baloon_counter"]/text()')[0].strip(),
entry.xpath('h4/text()')[0].strip())
for entry in document.xpath('//div[@class="entry"]')]
def sort_key(entry):
try:
return int(entry[0])
except ValueError:
return -1
entries.sort(reverse=True, key=sort_key)
for n, entry in enumerate(entries[:LIMIT]):
text = u'{:>2}. ({:>3}) {}'.format(n + 1, entry[0], entry[1])
if entry[1] == TALKNAME:
print COLOR + text + END
else:
print text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment