I have the following code. The first urllib call works the second does not. I have beat my head against the wall and can't figure it out.
Error is
status)
Bad Request
b''
Any Ideas?
Simi
#Getting Individual Customer services Info
custinfostart='custinforend ='%27,?,?int%20status)'
CustLink=custinfostart+curr_cust+custinforend
#print(CustLink)
savelinks.write(CustLink+'\n') #Save the url links so we can look at them for testing
req=urllib.request.Request(CustLink)
resp=urllib.request.urlopen(req)
respData=resp.read()
CustServ.write('Customer ID:'+curr_cust+'\n')
CustServ.write(str(respData)+'\n')
#*************************************************************************
#Getting Device Info
custinfostart='custinforend ='%27,%27n%27,%271%27,%27100%27,?,?,?int status)'
print(custinfostart)
print(curr_cust)
print(custinforend)
CustLink=custinfostart+curr_cust+custinforend
print(CustLink)
req=urllib.request.Request(CustLink)
# resp=urllib.request.urlopen(req)
try: resp=urllib.request.urlopen(req)
except urllib.error.URLError as e:
print(e.reason)
respData=resp.read()
print(respData)
sys.exit("Device Error")
respData=resp.read()
DeviceInfo.write(str(respData)+'\n')
Error is
status)
Bad Request
b''
Any Ideas?
Simi
#Getting Individual Customer services Info
custinfostart='custinforend ='%27,?,?int%20status)'
CustLink=custinfostart+curr_cust+custinforend
#print(CustLink)
savelinks.write(CustLink+'\n') #Save the url links so we can look at them for testing
req=urllib.request.Request(CustLink)
resp=urllib.request.urlopen(req)
respData=resp.read()
CustServ.write('Customer ID:'+curr_cust+'\n')
CustServ.write(str(respData)+'\n')
#*************************************************************************
#Getting Device Info
custinfostart='custinforend ='%27,%27n%27,%271%27,%27100%27,?,?,?int status)'
print(custinfostart)
print(curr_cust)
print(custinforend)
CustLink=custinfostart+curr_cust+custinforend
print(CustLink)
req=urllib.request.Request(CustLink)
# resp=urllib.request.urlopen(req)
try: resp=urllib.request.urlopen(req)
except urllib.error.URLError as e:
print(e.reason)
respData=resp.read()
print(respData)
sys.exit("Device Error")
respData=resp.read()
DeviceInfo.write(str(respData)+'\n')