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
204afa99
Commit
204afa99
authored
Jul 22, 2009
by
Josh Roesslein
Browse files
Added create, destroy, exists blocks methods.
parent
c5ec9aad
Changes
2
Hide whitespace changes
Inline
Side-by-side
api.py
View file @
204afa99
...
...
@@ -280,3 +280,34 @@ class API(object):
require_auth
=
True
)
"""Create a block"""
create_block
=
bind_api
(
path
=
'/blocks/create.json'
,
method
=
'POST'
,
parser
=
parse_user
,
allowed_param
=
[
'id'
],
require_auth
=
True
)
"""Destroy a block"""
destroy_block
=
bind_api
(
path
=
'/blocks/destroy.json'
,
method
=
'DELETE'
,
parser
=
parse_user
,
allowed_param
=
[
'id'
],
require_auth
=
True
)
"""Check if block exists"""
def
exists_block
(
self
,
**
kargs
):
try
:
bind_api
(
path
=
'/blocks/exists.json'
,
parser
=
parse_none
,
allowed_param
=
[
'id'
,
'user_id'
,
'screen_name'
],
require_auth
=
True
)(
self
,
**
kargs
)
except
TweepError
:
return
False
return
True
parsers.py
View file @
204afa99
...
...
@@ -116,3 +116,7 @@ def parse_verify_credentials(data, api):
def
parse_rate_limit
(
data
,
api
):
return
json
.
loads
(
data
)
def
parse_none
(
data
,
api
):
return
None
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