title: Status code error while fetching JSON data
body: <p>I am trying to Extract JSON data from URL with parameters to it and code is as follows:</p>
  
  <pre><code>import json
  from flask import Flask, render_template, request, jsonify
  import requests
  app = Flask(__name__)
  import urllib2
  
  @app.route("/",methods=['GET','POST'])
  def home():
  if request.method == 'POST':
      #user inputs
      valueone= request.form.get('first')
      valueTwo = request.form.get('second')
      valueThree = request.form.get('third')
      #api call 
      data = {"perfid" : {0}, "section" : {"hostname" : {1}, "iteration" : {2}, "sectionname" : "sysstat_M"}}
      req = urllib2.Request('http://api-latx-dev.corp.netapp.com/ws/spm/spm-general', json.dumps(data)) 
      response = urllib2.urlopen(req)
  
      the_page = response.read()
      url=response.getcode()
      returnData = {}
      if url.status_code == 200:
          returnData["status"] = "SUCCESS"
          returnData["result"] = the_page
          return jsonify(returnData)
      else:
          returnData["status"] = "ERROR"
          return jsonify(returnData)
      #jsonify(response.json())
  return render_template('index.html')
  </code></pre>
  
  <p>I need to fetch data But getcode() gives int which is not working with "if url.status_code == 200".Can anyone please suggest how to deal with it.</p>