Issue
I'm using GAE python 2.5 with Beautiful Soup 3.08 and something is happening that cuts off the first portion of my text.
Here is my code:
from google.appengine.api import urlfetch
from BeautifulSoup import BeautifulSoup
url = 'http://www.cmegroup.com/CmeWS/mvc/xsltTransformer.do?xlstDoc=/XSLT/da/DailySettlement_CPC-FUT.xsl&url=/da/DailySettlement/V1/DSReport/ProductCode/J4/FOI/FUT/EXCHANGE/XNYM/Underlying/J4?tradeDate=08/16/2012'
print '<hr>This is the raw result fetched (print result.content)<hr>'
result = urlfetch.fetch(url = url, method = urlfetch.GET)
print result.content
soup = BeautifulSoup(result.content)
print '<hr>This is prettified soup (soup.prettify)<hr>'
print soup.prettify()
print '<hr>here is the print out of iteration through the findall<hr>Go!<br>'
trSet = soup.findAll('tr')
if trSet is not None:
for i in trSet:
i.string
else:
print "Couldn't find TRs in Soup!"
My app site running this code is: http://mwp-test2.appspot.com/ What is happening is the first print is not occurring at all. Any ideas? (also I'm having trouble with Beautiful soup's findAll, but I was planning on asking that once I figure out this truncating problem)
Solution
When I ran your page the first print did appear to be working. Also, you should be using response.out.write instead of print. Take a look at the docs here: https://developers.google.com/appengine/docs/python/tools/webapp/overview
Answered By - Rob Curtis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.