Skip to content

Commit

Permalink
add getter for possible activity entry keys
Browse files Browse the repository at this point in the history
  • Loading branch information
csu committed Aug 6, 2014
1 parent f2144cf commit 0de8620
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions debug.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from quora import Quora, Activity

activity = Quora.get_activity('Christopher-J-Su')
quora = Quora()
activity = quora.get_activity('Christopher-J-Su')
# print activity.answers
# print activity.question_follows
print activity.user_follows
# print activity.upvotes
# print activity.questions
# print activity.questions

print quora.get_activity_keys()
9 changes: 8 additions & 1 deletion quora/pyquora.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import feedparser
import re

### Configuration ###
POSSIBLE_FEED_KEYS = ['link', 'id', 'published', 'title', 'summary']

### Enumerated Types ###
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
Expand All @@ -29,7 +32,7 @@ def get_count_for_user_href(soup, user, suffix):

def build_feed_item(item):
dict = {}
keys = ['link', 'id', 'published', 'title', 'summary']
keys = POSSIBLE_FEED_KEYS
for key in keys:
if key in item.keys():
dict[key] = item[key]
Expand Down Expand Up @@ -118,6 +121,10 @@ def get_activity(user):
activity.questions.append(build_feed_item(entry))
return activity

@staticmethod
def get_activity_keys():
return POSSIBLE_FEED_KEYS

class Activity:
def __init__(self, upvotes=[], user_follows=[], question_follows=[], answers=[], questions=[]):
self.upvotes = upvotes
Expand Down

0 comments on commit 0de8620

Please sign in to comment.