Skip to content

Instantly share code, notes, and snippets.

@imankulov
Last active December 10, 2015 22:28
Show Gist options
  • Save imankulov/4501954 to your computer and use it in GitHub Desktop.
Save imankulov/4501954 to your computer and use it in GitHub Desktop.
DjangoCon Europe voting results parser
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# requirements: requests, lxml
import requests
from lxml import html
def get_tree():
resp = requests.get('http://2013.djangocon.eu/vote/')
tree = html.fromstring(resp.text)
return tree
def parse_tree(tree):
entries = tree.xpath('//div[@class="entry"]')
for entry in entries:
cnt = int(entry.xpath('div[@class="baloon_counter"]/text()')[0])
title = entry.xpath('h4/text()')[0]
yield (cnt, title.encode('utf-8', 'ignore'))
def main():
tree = get_tree()
records = sorted(parse_tree(tree), reverse=True)
for record in records:
print '{0}: {1}'.format(*record)
if __name__ == '__main__':
main()
114: Asynchronous code in Django.
110: Let’s bankrupt Heroku: make your Django run fast
107: How to combine JavaScript & Django in a smart way
107: Advanced PostgreSQL in Django
106: Website security in Django
99: Designing a good API: Lessons Learned
97: Caching Django
93: Taming Ajax and Django
93: Does your shit scale?
87: Mock your database
85: Why Django sucks
85: Single page web applications with Django
82: Working smart with Django (so you don't have to work hard)
78: Real-time Web Applications with Mushroom
73: Linux process management -- you're doing it wrong
72: The path to Continuous Deployment
71: Django on Amazon Web Services
70: Taming multiple databases with Django
64: Administrative Interfaces
63: Building the programmable Web.
62: Apps for advanced plans, pricings, billings and payments in Django
60: Advanced Python through Django: Metaclasses
60: A Frontend Framework for the Django Admin Interface
59: Dynamic Models in Django
58: Speed up your Django apps with Jython and SPDY
57: Class-Based Views: Untangling the mess
56: Processing payments for the paranoid
56: Hidden gems of the Django testing world
55: Effective tests run fast as a leopard.
55: Building a stdlib for Django deployments on top of fabric
54: Django and Money
53: Code for Culture
47: Enterprise Django: transactions for web developers
46: Dealing with legacy projects
44: Next building block: web applications
44: How my sideproject turned distributed, complicated and profitable
44: Forms for the Fearless
43: Oh, the usability! Making usable web apps as a Django developer.
41: Surfing fast on slow connections
39: Having Your Pony and Committing It Too
39: Django for Designers
37: Getting recommendations out of nothing
36: A pragmatist's guide to Hypermedia APIs.
34: Juggling with virtualized Django in PyCharm
34: Everything looks like a nail
34: Deploy your Django app in 5 min with a PaaS
33: Prehistorical Python: Patterns past their prime
33: Deploy your Django app on Linode with git push
31: `get_or_create` considered harmful
31: Views can be Classy!
31: Model-Mommy: Smart fixtures for better tests
31: Don't be afraid to commit (or participate in other valuable ways)
31: Django and Healthcare
31: (Ab)using Redis as a Search Engine
30: Do you feel the chemistry? Developing scientific applications with Django.
29: Django prototyper
27: TransForm your Form
27: Play nice with others!
26: Single table inheritance
25: Developing Django apps: from python noob to django developer in 6 months
24: Another take on Dynamic Django models
23: Using django.test.Client beyond tests - it can also migrate data from legacy systems!
23: Heroku from a fanboy perspective
21: Integration of Django and non-Django tests
21: From data set to useful website
21: Bitcoin web apps with Django
20: Django and MongoEngine a match made in heaven?
19: How hard it is to be a gonewilder?
18: Teaching an Old Pony New Tricks (might change)
18: Coding for the Modern Warzone
17: Cold Turkey Django
12: Idle thoughts on designing software for the web
12: DaNKinDaB: a Django based webserver
11: Family Planning: Generating Django Apps from YAML Specs
7: What about Diazo?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment