pyspider爬取數據存入redis--2.測試數據庫連通性

直接上代碼python

 1 #!/usr/bin/env python
 2 # -*- encoding: utf-8 -*-
 3 # Created on 2017-10-27 09:56:50
 4 # Project: redis_test
 5 
 6 from pyspider.libs.base_handler import *
 7 import redis
 8 
 9 class Handler(BaseHandler):
10     crawl_config = {
11     }
12 
13     @every(minutes=24 * 60)
14     def on_start(self):
15         r = redis.Redis(host='ip',port=6380,db=0)
16         r.set('wang','zhi')
相關文章
相關標籤/搜索