My favorites | Sign in
Project Logo
                
Search
for
Updated Mar 31, 2007 by shabda.raaj
Labels: Featured, Phase-Deploy
UsageInstructions  

Using pynswers

Using pynswers is very easy. It is just one file Answers.py, with one class having four methods.

Yahoo answers has four available calls

  1. questionSearch
  2. getByCategory
  3. getQuestion
  4. getByUser
Pynswers has four methods called(wonder!)
  1. questionSearch
  2. getByCategory
  3. getQuestion
  4. getByUser

Each method returns a list of dictionaries.

To use Pynswers, import the class and

>>>app = Answers()
>>>app.appid = 'your secret yahoo appid'
>>>questions = app.questionSearch({'query':'cats',})
>>>print questions[0]['UserId']

questionSearch

Find questions that match your query. Parameters listed here are accepted. query is a required parameter.

usage

>>>app = Answers()
>>>app.appid = 'your secret yahoo appid'
>>>app.questionSearch({'query':'cats',})

getByCategory

List questions from one of our hundreds of categories, filtered by type. You'll need the category name or ID, which you can get from questionSearch. Parameters listed here are accepted. Either category_id or category_name is a required.

Usage

>>>app.getByCategory({'category_id':'396546304'})

getQuestion

Found an interesting question? getQuestion lists all the details for every answer to the question ID you specify, including the best answer, if it's been chosen. Get that question ID from questionSearch or getByCategory. Parameters listed here are accepted. question_id is a required parameter.

Usage

>>>app.getQuestion({'question_id':'20070331070321AAlyopp'})

getByUser

List questions from specific users on Yahoo! Answers. You'll need the user id, which you can get from any of the other services listed above. Parameters listed here are accepted. user_id is a required parameter.


Sign in to add a comment
Hosted by Google Code