fix twitter api responses
This commit is contained in:
parent
f8aab50eae
commit
a41a7dc052
@ -18,12 +18,9 @@ def get_twitter_accounts():
|
||||
account_data['username'] = account.username
|
||||
accounts.append(account_data)
|
||||
|
||||
return Response(
|
||||
jsonify({
|
||||
"twitter_accounts": accounts
|
||||
}),
|
||||
status=200,
|
||||
)
|
||||
return jsonify({
|
||||
"twitter_accounts": accounts
|
||||
}), 200
|
||||
|
||||
@twitter.route('/account', methods=['POST'])
|
||||
def add_twitter_account():
|
||||
@ -31,10 +28,7 @@ def add_twitter_account():
|
||||
if (content_type == 'application/json'):
|
||||
json = request.json
|
||||
if not json['veryfier'] or not json['oauth_token'] or not json['oauth_token_secret']:
|
||||
return Response(
|
||||
"Invalid request!",
|
||||
status=400,
|
||||
)
|
||||
return "Invalid request!", 400
|
||||
else:
|
||||
consumer_key = current_app.config["TWITTER_CONSUMER_KEY"]
|
||||
consumer_secret = current_app.config["TWITTER_CONSUMER_SECERT"]
|
||||
@ -59,15 +53,6 @@ def add_twitter_account():
|
||||
twitter_db.session.add(new_twitter_account)
|
||||
twitter_db.session.commit()
|
||||
|
||||
return Response(
|
||||
jsonify({
|
||||
"message": "Twitter account succesfully added."
|
||||
}),
|
||||
status=201,
|
||||
)
|
||||
return "Twitter account succesfully added.", 201
|
||||
else:
|
||||
return Response(
|
||||
"Content-type not supported!",
|
||||
status=400,
|
||||
)
|
||||
|
||||
return "Content-type not supported!", 400
|
||||
|
Loading…
Reference in New Issue
Block a user