-def api_call(user, path, data=None, beta=False):
+def api_call(user, path, data=None, beta=False, method=None, as_json=False):
from .models import OAuthConnection
api_url = BETA_API_URL if beta else WL_API_URL
conn = OAuthConnection.get(user=user, beta=beta)
from .models import OAuthConnection
api_url = BETA_API_URL if beta else WL_API_URL
conn = OAuthConnection.get(user=user, beta=beta)
resp, content = client.request(
"%s%s" % (api_url, path),
resp, content = client.request(
"%s%s" % (api_url, path),
return json.loads(content)
elif status.startswith('2'):
return
elif status == '401':
raise ApiError('User not authorized for publishing.')
else:
return json.loads(content)
elif status.startswith('2'):
return
elif status == '401':
raise ApiError('User not authorized for publishing.')
else:
- raise ApiError("WL API call error %s, path: %s" % (status, path))
+ raise ApiError("WL API call error %s, path: %s, body: %s" % (status, path, content))