Language : python

Title User Language Tags Description Date
How to read "_id" field of an object in django templates viroide Python

It's imposible to read de "id" field en django templates ( {{element.id}} === error) So, to read it, you must do a templatetag.

Now you hace the templatetag, you can use it like this: {{element|pk}}

June 7
Pandora for Food – Crawl Yelp for personalized recommendations richyeung Python

This is just a fun little script that acts like a Pandora for food. Its implementation is simplistic. You choose a set of restaurants on Yelp that you like, and the script finds all reviewers that gave these restaurants 5 stars. You trust these reviewers because they share your awesome taste in food. The script then spits out all restaurants that these "trusted reviewers" also reviewed, and their rating for each review.

You would need a few additional lines of code to turn the scrapy output into a sorted list of restaurants. For example, the code below will sort restaurants by number of "trusted reviewers": \n import pandas \n reviews = pandas.readcsv('scrapyoutput.csv') fiveStarReviews = reviews[reviews['rating']==5] fiveStarReviews.restaurant.value_counts()

There are countless ways you can improve on this. One obvious one is you would want to normalize by total restaurant reviews. You would probably also want to pull in restaurant category information.

Happy food hunting!

May 31
Objectjson - JSON to nested object. plainwreck Python

Makes working with JSON data, in my eyes, easier in Python.

Instead of

json_data['key']['key']['key']

Do

json_data.key.key.key

This can also be modified to work the same way with dict types.

May 17
Email to HTML Script drydenlong Python

A script to parse emails and return HTML suited for email blast programs

May 15
LJAutoComment aruseni Python

This class is used to automatically update a LiveJournal blog’s RSS feed, detect new entries and post a comment if the entry is new enough (i.e. is posted in a given period of time from now, for example not older than 1 hour)

Example:

comment = u"Первый комментарий."

engine = LJAutoComment('http://asena.livejournal.com/data/rss', 'user', 'password', comment, 1)
engine()
May 3
Scrape list of all NBA players asimmittal Python

This is a python script that allows you to scrape historical player names and links from NBA.com historical data

April 28
Replace procedural Nuke Write paths with real paths in write node by replacing the write node(s) throb Python

This allows you to take a node that has expressions in it and create copies of them that are hard pathed. It will also disable said expression driven write nodes and disable them.

April 23
Get ARP MAC from IP address someguy123 Python

This can be used to get arp mac address from a ip address. Remember that MAC addresses are in arp tables (volatile), that's why a ping is done first. But i don't know if timing between ping call and arp call is enought to make sense (of pinging).

April 18
Synesthor Thinks (get a color from colorrrs.com) nerdfiles Python

alias synesthor_thinks="py /Users/nerdfiles/Tools/colorrrs/colorrrs.py | pbcopy"

February 2
Command Line IMDB Scraper spilcm Python

This script will ask for a movie title and a year and then query IMDB for it.

January 13
Create Excel file with xlwt and insert in Flask response valid for jquery.fileDownload doronhor Python

A combinations of 3 technologies. Needed to create Excel files within a Python Flask web framework environment and have it sent via HTTP to client to be handled by the jquery.fileDownload library.

Notes: 1. Flask has to set a cookie specified by jquery.fileDownload 2. Divided code into blocks of code that can be maybe reusable in functions 3. 'app' is not declared but it is obvious a Flask application object

relevant projects: 1. http://flask.pocoo.org/ 2. pypi.python.org/pypi/xlwt and www.python-excel.org/ 3. https://github.com/johnculviner/jquery.fileDownload

January 4
Clean files/directory by time. djmornyc Python

*Does not check permissions. python cleanFiles.py --directory=/home/win98/tmp/ --ageInDays=2

December 15
batch accounts import into discuz with python dylanninin Python

batch accounts import into discuz with python

December 4
Python main with options ssoton Python

Snippet to show how works optparse module to add optoins when it is called by command line

November 29
mvc trurl Python

Minimal mvc sample code with python + wx

November 29