parameters: (self, parts, data = None)
docstring: General API call (do not use it directly!)
docstring_summary: General API call (do not use it directly!)
docstring_tokens: General API call ( do not use it directly! )
function: def get(self, parts, data = None):
          """
          General API call (do not use it directly!)
          """
  
          #
          # Constructing request path
          #
  
          callurl = self.url + "/".join(urllib.quote(p) for p in parts)
  
          #
          # Constructing data payload
          #
  
          sdata = None
          if data != None:
              sdata = json.dumps(data)
  
          #
          # Do the query and respond
          #
  
          self.dprint(callurl, "with payload", sdata)
  
          resp = urllib.urlopen(callurl, sdata)
  
          has_getcode = "getcode" in dir(resp)
          if self.debug: 
              if has_getcode:
                  self.dprint("Response", resp.getcode(), " ".join(str(resp.info()).split("\r\n")))
              else:
                  self.dprint("Response", " ".join(str(resp.info()).split("\r\n")))
  
          if not has_getcode or resp.getcode() == 200:
              rdata = resp.read()
              if re.search("json", resp.info().gettype()):
                  try:
                      return json.loads(rdata)
                  except TypeError as e:
                      self.dprint(e)
                      return rdata
              else:
                  return rdata
          else:
              raise RRApiError(resp)
function_tokens: def get ( self , parts , data = None ) : # # Constructing request path # callurl = self . url + "/" . join ( urllib . quote ( p ) for p in parts ) # # Constructing data payload # sdata = None if data != None : sdata = json . dumps ( data ) # # Do the query and respond # self . dprint ( callurl , "with payload" , sdata ) resp = urllib . urlopen ( callurl , sdata ) has_getcode = "getcode" in dir ( resp ) if self . debug : if has_getcode : self . dprint ( "Response" , resp . getcode ( ) , " " . join ( str ( resp . info ( ) ) . split ( "\r\n" ) ) ) else : self . dprint ( "Response" , " " . join ( str ( resp . info ( ) ) . split ( "\r\n" ) ) ) if not has_getcode or resp . getcode ( ) == 200 : rdata = resp . read ( ) if re . search ( "json" , resp . info ( ) . gettype ( ) ) : try : return json . loads ( rdata ) except TypeError as e : self . dprint ( e ) return rdata else : return rdata else : raise RRApiError ( resp )