Im trying to deploy a pandas data frame to a URL and get the return from some fields in new columns in the same data frame.The aim is to loop through each row.
The data frame looks like this :
name state postcode VIC NSW ACT NT
coles VIC 2501 Y N N N
woolworth NSW 3409 N Y N N
big w ACT 3201 N N Y N
target NT 1089 N N N Y
I want the name of my columns per row to be deployed and the results in new columns as the example show below. The code below works but I can only make work manually.
import urllib.request as req
name = ''
postcode = ''
legalName = ''
tradingName = ''
NSW = ''
SA = ''
ACT = ''
VIC = ''
WA = ''
NT = ''
QLD = ''
TAS = ''
authenticationGuid = 'b6aaddd4-8463-4d76-9e24-99530f5df326' #Your GUID should go here
#Constructs the URL by inserting the search parameters specified above
#GETs the url (using urllib.request.urlopen)
conn = req.urlopen('http://abr.business.gov.au/abrxmlsearchRPC/AbrXmlSearch.asmx/' +
'ABRSearchByNameSimpleProtocol?name=' + name +
'&postcode=' + postcode + '&legalName=' + legalName +
'&tradingName=' + tradingName + '&NSW=' + NSW +
'&SA=' + SA + '&ACT=' + ACT + '&VIC=' + VIC +
'&WA=' + WA + '&NT=' + NT + '&QLD=' + QLD +
'&TAS=' + TAS + '&authenticationGuid=' + authenticationGuid)
#XML is returned by the webservice
#Put returned xml into variable 'returnedXML'
#Output xml string to file 'output.xml' and print to console
returnedXML = conn.read()
f = open('output.xml', 'wb')
f.write(returnedXML)
f.close
print(returnedXML)