[英]Scrapy and DynamoDB: Passing a timestamp
At this moment I collect a timestamp directly from the website I parse but I noticed they don't differentiate am/pm. 目前,我直接从解析的网站收集时间戳,但我注意到它们无法区分上午/下午。 Is there a way to make DynamoDB or the script to put a timestamp with proper time (am/pm)? 有没有办法使DynamoDB或脚本在适当的时间(am / pm)放置时间戳? The only thing I could find was creation_time (boto3) but that's for the table. 我唯一能找到的是creation_time(boto3),但这是针对表的。 Any suggestions? 有什么建议么? Thank you. 谢谢。
My pipeline: 我的管道:
class DynamoDBStorePipeline(object):
def process_item(self, item, spider):
dynamodb = boto3.resource('dynamodb',region_name="us-west-2")
table = dynamodb.Table('x')
table.put_item(
Item={
'url': str(item['url']),
'title': item['title'].encode('utf-8'),
'stamp': item['stamp'].encode('utf-8'),
}
)
return item
I found a nice plugin on pip directory: 我在pip目录中找到了一个不错的插件:
pip install tstamp
and using there documentation was able to pass a timestamp 并且使用那里的文档能够传递时间戳
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.