Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#Getting Individual Customer services Info custinfostart='http://172.17.3.17:7780/da

Status
Not open for further replies.

simian336

Programmer
Sep 16, 2009
723
0
0
US
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')
 
Hi

Please edit you post and enclose code blocks in [tt][ignore]
Code:
[/ignore][/tt] .. [tt][ignore]
[/ignore][/tt] TGML tags to preserve indentation and avoid the site engine to shorten and destroy URLs.


Feherke.
feherke.ga
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top