title: How to check if the url contains JSON file
body: <p>I'm working with <strong>League of Legends API</strong>, and I'm trying to get Ranked Datas from <strong>JSON</strong> file. But, if the player is not <strong>Level 30</strong>, he doesn't have his file.
  So here</p>
  
  <pre><code>def getRankedData(region, ID, APIkey):
      URL = "https://" + region + ".api.pvp.net/api/lol/" + region + "/v2.5/league/by-summoner/" + ID + "/entry?api_key=" + APIkey
      response = requests.get(URL)
      return response.json()
  </code></pre>
  
  <p>It won't get <strong>JSON</strong> file, because it doesn't exist. How do i can do, that if the <strong>URL</strong> doesn't exist and doesn't have the JSON file, it returns the string.</p>
  
  <p>Here, I'm returning the datas to <strong>HTML</strong> page. But this isn't work too.</p>
  
  <pre><code> region = request.form['region']
   summonerName = request.form['summonerName']
   APIkey = "45afde27-b628-473f-9a94-feec8eb86094"
   types = request.form['types']
   responseJSON = getData(region, summonerName, APIkey)
   ID = responseJSON[summonerName]['id']
   ID = str(ID)
   responseJSON2 = getRankedData(region, ID, APIkey)
   if not responseJSON2:
       divisionName = "Unranked"
   else: 
       divisionName = responseJSON2[ID][0]['name']
   responseJSON3 = getChallengerPlayers(region, str(types), APIkey)
   challengerPlayers = responseJSON3['entries'][0]['wins']
   #print challengerPlayers
  
   return render_template('form_action.html', ID = ID, divisionName = divisionName, challengerPlayers = challengerPlayers)
  </code></pre>
  
  <p>I'm getting this error: </p>
  
  <pre><code>Traceback (most recent call last)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1836, in __call__
  return self.wsgi_app(environ, start_response)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app
  response = self.make_response(self.handle_exception(e))
  File "C:\Python27\lib\site-packages\flask\app.py", line 1403, in      handle_exception
  reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app
  response = self.full_dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in     full_dispatch_request
  rv = self.handle_user_exception(e)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in  handle_user_exception
  reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in     full_dispatch_request
  rv = self.dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in  dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\Hanisek\Documents\Visual Studio     2015\Projects\FlaskWebProject2\FlaskWebProject2\FlaskWebProject2\views.py", line 53, in hello
  responseJSON2 = getRankedData(region, ID, APIkey)
  File "C:\Users\Hanisek\Documents\Visual Studio 2015\Projects\FlaskWebProject2\FlaskWebProject2\FlaskWebProject2\views.py", line 21, in getRankedData
  Open an interactive python shell in this framereturn response.json()
  File "C:\Python27\lib\requests\models.py", line 805, in json
  return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 338, in loads
  return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 366, in decode
  obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
  raise ValueError("No JSON object could be decoded")
  ValueError: No JSON object could be decoded
  </code></pre>