Skip to content

Instantly share code, notes, and snippets.

@gustavofonseca
Created August 27, 2012 13:20
Show Gist options
  • Save gustavofonseca/3488348 to your computer and use it in GitHub Desktop.
Save gustavofonseca/3488348 to your computer and use it in GitHub Desktop.
listagens do books em csv
# coding:utf-8
import couchdbkit
BASE_URL = 'http://books.scielo.org/id/%s'
server = couchdbkit.Server(uri='http://192.168.1.12:5984/')
db = server['scielobooks_1a']
print 'sbid|title|url'
for book in db.view('books/published_books', include_docs=True):
row = [book['id'], book['value'].get('title'), BASE_URL % book['id']]
print '|'.join(row).encode('utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment