所以,我在我的项目中使用django-registration来启用我正在构建的应用程序中的用户自注册。我已将 django-registration 配置为向注册用户发送确认电子邮件。
我的settings.py:
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'myUser@myCompany.com'
EMAIL_HOST_PASSWORD = 'apassword'
...
ACCOUNT_ACTIVATION_DAYS = 7
Run Code Online (Sandbox Code Playgroud)
但是,在用户填写注册表并单击注册按钮后,页面会一直等待电子邮件发送过程。看起来只有在发送电子邮件后才会收到响应(确认页面)。
我已经阅读了另一个线程,该线程显示了如何在线程中发送电子邮件。有没有办法使用 django-registration 发送电子邮件,以便在发送电子邮件之前不会阻止表单注册提交的响应?我的意思是,我不想修改它django-registration本身。
这是网站中“查看更多”按钮的检查。我可以爬行网站中显示的数据,但我希望它可以爬行隐藏在“查看更多”按钮后面的项目。我怎么做?
<div id="view-more" class="p20px pt10px">
<div id="view-more-loader" class="tac"></div>
<a href="javascript:void(0);" onclick="add_more_product_classified();$('#load_more_a_id').hide();" class="xxxxlarge ffrc lightbginfo gbiwb bdr darkbdrinfo p10px20px db w180px m0a tac" id="load_more_a_id" style="display: block;"><b class="icon-refresh xsmall mr5px"></b>View More Products..</a>
</div>
Run Code Online (Sandbox Code Playgroud)
我的scrapy代码:
import scrapy
class DummymartSpider(scrapy.Spider):
name = 'dummymart'
allowed_domains = ['dummymart.net']
start_urls =['https://www.dummymart.com/catalog/car-dvd-player_cid100001018.html']
def parse(self, response):
Product = response.xpath('//div[@class="attr"]/h2/a/@title').extract()
Company = response.xpath('//div[@class="supplier"]/p/a/@title').extract()
Country = response.xpath('//*[@class="location a-color-secondary"]/span/text()').extract()
Category = response.xpath('//*[@class="attr category hide--mobile"]/span/a/text()').extract()
for item in zip(Product,Company,Country,Category):
scraped_info = {
'Product':item[0],
'Company': item[1],
'Country':item[2],
'Category':item[3]
}
yield scraped_info
Run Code Online (Sandbox Code Playgroud)