I'm working on a simple REST service with flask, the method deleteTweets() can't retrieve the URL parameter i'm sending, so tried to print to see what is sending but i get this error line.
File "C:\Path\HomeController.py", line 26, in deleteTwee
ts
id = request.args.get['id']
AttributeError: 'function' object has no attribute 'args'
127.0.0.1 - - [17/Jan/2018 12:00:05] "DELETE /api/deleteTweet?id=ABC HTTP/1.1" 500
This the code:
import json
import Service
from flask import Flask, render_template,jsonify,request
app = Flask(__name__)
apiUrl='/api'
@app.route('/')
def hello_world():
return render_template("/home.html", code=400)
@app.route(apiUrl+'/getData', methods=['GET'])
def test_request():
list = [15,21,8]
return jsonify(list)
@app.route(apiUrl+'/getTweets', methods=['GET'])
def request():
return Service.getAlltwits()
@app.route(apiUrl+'/deleteTweet', methods=['DELETE'])
def deleteTweets():
id = request.args.get['id']
print(id)
return
It's very simple but not sure what i did missed.
also tried with id = request.args.get('id')