Chitransh Mathur
Chitransh Mathur

Reputation: 37

Adobe Analytics API warehouse JSON decode error

I have been extracting the data from adobe analytics warehouse using REST API. The code has been working since last 2 years, but from last 7 days have been experiencing the error : JSONDecodeError: Expecting value: line 1 column 1 (char 0).

The code used is: Function Defined:

def reportWaitTime(reportId,runTime):  
  start = time.time()
  r2_dw=requests.post(url=url_get,headers=HEADER,json={"reportID":reportId})
  if r2_dw.status_code!=200:
    # time.sleep(120)
    end=time.time()
    timeElapsed=end-start
    TIME=runTime+timeElapsed
    Time_=(TIME/60)
    print("wait,Time elapsed:",Time_,"minutes")
    print("reportId : " ,reportId)
    reportWaitTime(reportId,TIME)
  else:
    # returnValue=r2_dw.json()
    returnValue=r2_dw.json()["report"]["totalPages"]
    return returnValue

Function Used:

Rtime=0
totalPages = None
while(totalPages == None):
  totalPages=reportWaitTime(reportId,Rtime)
  print("Total Pages are:"+ str(totalPages))

The resulting output of this function gives the number of pages the report has and it prepares the report.

Error image: enter image description here

Can any tell what is the issues here now?

Upvotes: 0

Views: 33

Answers (0)

Related Questions