This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, jsonify, request | |
from threading import Timer, Thread | |
from time import sleep | |
app = Flask(__name__) | |
@app.route("/api/<method>") | |
def api(method): | |
data = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import selenium | |
from scrapy.spider import BaseSpider | |
from scrapy.http import Request | |
import time | |
import lxml.html | |
class SeleniumSprider(BaseSpider): | |
name = "selenium" | |
allowed_domains = ['selenium.com'] | |
start_urls = ["http://localhost"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.util.Timer timer = new java.util.Timer(true); | |
// true 说明这个timer以daemon方式运行(优先级低, | |
// 程序结束timer也自动结束),注意,javax.swing | |
// 包中也有一个Timer类,如果import中用到swing包, | |
// 要注意名字的冲突。 | |
TimerTask task = new TimerTask() { | |
public void run() { | |
... //每次需要执行的代码放到这里面。 | |
} |