twitter #2
@ -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"]
|
||||
@ -58,16 +52,7 @@ 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