I am sending a json request and capturing the request parameter in python flask service to process further. However, when I json dump the request and try to gather specific parameter values from it, it gives me error
"string indices must be integers, not str"
This is the json that I parsed in python flask:
{"description": "URL: https://sometest.xyz.com/test16/apicall\\n Issue: sample issue\\n Result: fail\\n Severity: low\\n Category: sample category", "issuetype": {"name": "Bug"}, "priority": {"name": "Trivial"}, "project": "sample-project", "summary": "sample issue - https://sometest.xyz.com/test16/apicall"}
I am not able to figure out what is wrong I'm doing.
Here is my python flask code:
from flask import Flask
from flask import request
from flask import json
import httplib
httplib.HTTPConnection.debuglevel = 2
app = Flask(__name__)
@app.route('/', methods=['POST','GET'])
def main():
_jsonreq = json.dumps(request.json)
return _jsonreq['project']
if __name__ == "__main__":
app.run(debug=True)