Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
22d10a73
Commit
22d10a73
authored
Feb 04, 2011
by
Aaron Swartz
Committed by
Josh Roesslein
Feb 04, 2011
Browse files
Add support for related_result
parent
b4c2ce23
Changes
2
Hide whitespace changes
Inline
Side-by-side
tweepy/api.py
View file @
22d10a73
...
...
@@ -77,6 +77,14 @@ class API(object):
allowed_param
=
[
'id'
,
'count'
,
'page'
],
require_auth
=
True
)
"""/related_results/show/:id.format"""
related_results
=
bind_api
(
path
=
'/related_results/show/{id}.json'
,
payload_type
=
'relation'
,
payload_list
=
True
,
allowed_param
=
[
'id'
],
require_auth
=
False
)
"""/statuses/:id/retweeted_by/ids.format"""
retweeted_by_ids
=
bind_api
(
...
...
tweepy/models.py
View file @
22d10a73
...
...
@@ -276,6 +276,19 @@ class List(Model):
def
is_subscribed
(
self
,
id
):
return
self
.
_api
.
is_subscribed_list
(
self
.
user
.
screen_name
,
self
.
slug
,
id
)
class
Relation
(
Model
):
@
classmethod
def
parse
(
cls
,
api
,
json
):
result
=
cls
(
api
)
for
k
,
v
in
json
.
items
():
if
k
==
'value'
and
json
[
'kind'
]
in
[
'Tweet'
,
'LookedupStatus'
]:
setattr
(
result
,
k
,
Status
.
parse
(
api
,
v
))
elif
k
==
'results'
:
setattr
(
result
,
k
,
Relation
.
parse_list
(
api
,
v
))
else
:
setattr
(
result
,
k
,
v
)
return
result
class
JSONModel
(
Model
):
...
...
@@ -308,6 +321,7 @@ class ModelFactory(object):
saved_search
=
SavedSearch
search_result
=
SearchResult
list
=
List
relation
=
Relation
json
=
JSONModel
ids
=
IDModel
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment