Commit 204afa99 authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Added create, destroy, exists blocks methods.

parent c5ec9aad
......@@ -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
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment