title: What is my code missing to get a JSON response from my URL link
body: <p>I built a python client REST API wrapper for an Okta authenticated pricing API. My code runs but I am not getting any response back. I need to be able to get a JSON response. I believe a print statement would work but I hit a wall do not know what argument to pass the print statement in order to receive a response from
  &quot;conn = http.client.HTTPSConnection(&quot;sso.lukka.tech&quot;)&quot;</p>
  <pre><code>import http.client
  import urllib.request, urllib.parse, urllib.error
  import json
  import base64
  
  def loadJson(response):
      body = response.read()
      if body == &quot;&quot; or body is None:
          print((&quot;Empty response found with status &quot; + str(response.status)))
          return {}
      else:
          return json.loads(body)
  
  class DataPricingClient:
  
      def __init__(self, host, clientId, clientSecret):
          conn = http.client.HTTPSConnection(&quot;sso.lukka.tech&quot;)
          path = &quot;/oauth2/aus1imo2fqcx5Ik4Q0h8/v1/token&quot;
          encodedData = base64.b64encode(bytes(f&quot;{clientId}:{clientSecret}&quot;, &quot;ISO-8859-1&quot;)).decode(&quot;ascii&quot;)
          authHeader = &quot;Basic &quot; + encodedData
          headers = {
              &quot;Authorization&quot;: authHeader,
              &quot;Accept&quot;: &quot;application/json&quot;,
              &quot;Content-Type&quot;: &quot;application/x-www-form-urlencoded&quot;
          }
          params = urllib.parse.urlencode({
              &quot;grant_type&quot;: &quot;client_credentials&quot;,
              &quot;scope&quot;: &quot;pricing&quot;
          })
  
          conn.request(&quot;POST&quot;, path, params, headers)
          response = conn.getresponse()
  
          if response.status != 200:
              raise ApiErrorException(response.status, &quot;Failed to get access token&quot;)
  
          self.host = host
          self.accessToken = loadJson(response)[&quot;access_token&quot;]
  
      def default_headers(self):
          return {
              &quot;Content-Type&quot;: &quot;application/json&quot;,
              &quot;Accept&quot;: &quot;application/json&quot;,
              &quot;Authorization&quot;: &quot;Bearer &quot; + self.accessToken
          }
      
      def _send_request(self,path):
          with http.client.HTTPSConnection(self.host) as conn:
              headers = self.default_headers()
              conn.request(&quot;GET&quot;, path, None, headers)
              response = conn.getresponse()
          return response
  
      def get_available_sources(self):
          path = &quot;/v1/pricing/sources&quot;
          return _send_request(path)
  
      def get_source_details(self, sourceId):
          path = f&quot;/v1/pricing/sources/{sourceId}&quot;
          return _send_request(path)
  
      def get_latest_prices(self,asOf, sourceId, pairCodes):
           path = f&quot;/v1/pricing/sources/{sourceId} {pairCodes}&quot;
           return _send_request(path)
  
      def historical_prices(self, sourceId, pairCode, begTs, endTs, fill, limit, variances):
          path = f&quot;/v1/pricing/sources/{sourceId} {pairCode} {begTs} {endTs} {fill} {limit} {variances}&quot;
          return _send_request(path)
  
  
  class ApiErrorException(Exception):
      def __init__(self, status, msg):
          self.msg = &quot;Error &quot; + str(status) + &quot;: &quot; + msg
      def __str__(self):
          return self.msg
  
  if __name__ == '__main__':
      from pricing_api_creds import lukka_pricing
      c = DataPricingClient(**lukka_pricing)
  </code></pre>