Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBeau Genereux
5,362 PointsMy response outputs "content+scrapy" instead of "ken.alger+scrapy" (???)
My code returns a different results than in the course...
from scrapy.http import FormRequest
from scrapy.spiders import Spider
class FormSpider(Spider):
name = 'horseForm'
start_urls = ['https://treehouse-projects.github.io/horse-land/form.html']
def parse(self, response):
formdata = {'firstname': 'Ken',
'lastname': 'Alger',
'jobtitle': 'Teacher'}
# Submits the formdata above to the form and submits it.
return FormRequest.from_response(response, formnumber=0,
formdata=formdata,
callback=self.after_post)
def after_post(self, response):
#print('Form processed.\n', response)
print('\n\n****** Form processed ******\n\n')
# Prints <200 https://formspree.io/content+scrapy@teamtreehouse.com> instead of <200 https://formspree.io/ken.alger+scrapy@teamtreehouse.com>
print(response)
# Prints the entire page html, js and all
#print(response.text)
print('\n\n****** Script completed ******\n\n')
I'm not sure why it returns "content" instead of the "firstname.lastname" as seen in class.
1 Answer
Mel Rumsey
Treehouse ModeratorHey Beau Genereux ! It looks like that is just Ken's account for formspree.io. I think the point in the video is to make sure that you get a 200
response code back when printing the response