2011-12-13, 01:20
ah awesome as I have been struggling for some reason with a urllib POST. Much nicer to do it all with your stuff I reckon.
To get from trunk do I have to pull it from GIT? Do you have your own repo for that or is just in trunk xbmc? Sorry, still a bti new to git.
My code is:
...it's just some hacky test code but it's not working grrr...all it does is get the /search/ page without any results as if it is not doing a POST.
To get from trunk do I have to pull it from GIT? Do you have your own repo for that or is just in trunk xbmc? Sorry, still a bti new to git.
My code is:
Code:
text = '3051'
#need to submit the postcode to the weatherzone search
searchURL = 'http://weatherzone.com.au/search/'
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = { 'User-Agent' : user_agent }
#need to fetch a page with POST variables
values = {'q' : text, 't' : '3', 'action' : '/search/'}
data = urllib.urlencode(values)
print 'Encoded:', data
req = urllib2.Request(searchURL, data, headers)
response = urllib2.urlopen(req)
resultPage = str(response.read())
print response.geturl()
skimmed = common.parseDOM(resultPage, "ul", attrs = { "class": "typ2" })
print '*********************', skimmed
...it's just some hacky test code but it's not working grrr...all it does is get the /search/ page without any results as if it is not doing a POST.