随笔
我只是占个tag坑…😂
我只是占个tag坑…😂
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2017年5月24日
@author: BirdZhang
'''
from bs4 import BeautifulSoup
import mechanize
import cookielib
from wyblog import BLOG_URL
class NoHistory(object):
def add(self, *a, **k): pass
def clear(self): pass
def getBrowers():
br = mechanize.Browser(history=NoHistory())
#options
br.set_handle_equiv(True)
#br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)##关联cookies
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.set_debug_http(False)
br.set_debug_redirects(False)
br.set_debug_responses(False)
br.addheaders = [("User-agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36")]
return br
if __name__ == "__main__":
br = getBrowers()
r = br.open(BLOG_URL)
html = r.read()
# print html
soup = BeautifulSoup(html,"html5lib")
lis = soup.find_all(name='li',attrs={
"class":"list-group-item title"
})
for i in lis:
print i.a["href"]," ".join(i.a.contents)
剩下的自己该干嘛干嘛吧
更多logrotate的说明见 http://www.linuxcommand.org/man_pages/logrotate8.html
或者这里 https://linux.cn/article-4126-1.html
在/etc/logrotate.d/tomcat
里写入下面的内容
1 | /data/logs/logpath/catalina-daemon.out { |
测试
logrotate --force /etc/logrotate.d/tomcat.conf
查看是否有一个/data/logs/logpath/catalina-daemon.out.1生成
很简单,cronolog对jsvc启动的tomcat不友好
原文 https://developers.google.com/drive/v3/web/quickstart/python
pip install --upgrade google-api-python-client
谷歌上的步骤:
1 | Use this wizard to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials. |
内容大概如下
1 | {"installed":{"client_id":"334720361216-xxxxx.apps.googleusercontent.com","project_id":"analog-fastness-167807","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"xxxxxx","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}} |
1 | #!/usr/bin/env python |
用以下命令:
/cs op #jolla-cn +o birdzhang