echorev 0.0.8__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- echorev-0.0.8/LICENSE +674 -0
- echorev-0.0.8/PKG-INFO +9 -0
- echorev-0.0.8/README.md +28 -0
- echorev-0.0.8/echorev/__init__.py +251 -0
- echorev-0.0.8/echorev/get.png +0 -0
- echorev-0.0.8/echorev/getB.py +60 -0
- echorev-0.0.8/echorev/github.png +0 -0
- echorev-0.0.8/echorev/icon.png +0 -0
- echorev-0.0.8/echorev/quit.png +0 -0
- echorev-0.0.8/echorev/setup.py +33 -0
- echorev-0.0.8/echorev/test.py +255 -0
- echorev-0.0.8/echorev/tmp.py +58 -0
- echorev-0.0.8/echorev/update.png +0 -0
- echorev-0.0.8/echorev.egg-info/PKG-INFO +9 -0
- echorev-0.0.8/echorev.egg-info/SOURCES.txt +18 -0
- echorev-0.0.8/echorev.egg-info/dependency_links.txt +1 -0
- echorev-0.0.8/echorev.egg-info/requires.txt +1 -0
- echorev-0.0.8/echorev.egg-info/top_level.txt +1 -0
- echorev-0.0.8/setup.cfg +4 -0
- echorev-0.0.8/setup.py +33 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from urllib import request
|
|
2
|
+
req = request.Request('https://www.zhihu.com')
|
|
3
|
+
req.add_header('User-Agent', 'Mozilla/6.0')
|
|
4
|
+
response = request.urlopen(req)
|
|
5
|
+
# 获取状态码,如果是200表示成功
|
|
6
|
+
print(response.status)
|
|
7
|
+
# 读取网页内容
|
|
8
|
+
# print(response.read().decode('utf-8'))
|
|
9
|
+
|
|
10
|
+
#保存cookie的文件
|
|
11
|
+
import urllib.request
|
|
12
|
+
import http.cookiejar
|
|
13
|
+
|
|
14
|
+
filename = 'cookie.txt'
|
|
15
|
+
# 声明一个MozillaCookieJar对象实例(cookie)来保存cookie,后面写入文件
|
|
16
|
+
url = 'http://www.zhihu.com'
|
|
17
|
+
cookie = http.cookiejar.MozillaCookieJar(filename)
|
|
18
|
+
# 还是创建处理器
|
|
19
|
+
handler = urllib.request.HTTPCookieProcessor(cookie)
|
|
20
|
+
# 创建支持处理HTTP请求的opener对象
|
|
21
|
+
opener = urllib.request.build_opener(handler)
|
|
22
|
+
opener.open(url)
|
|
23
|
+
# 保存cookie到文件
|
|
24
|
+
cookie.save(ignore_discard=True, ignore_expires=True)
|
|
25
|
+
# ignore_discard表示即使cookie将被丢弃也将保存下来,ignore_expires表示如果该文件中cookie已经存在,则覆盖原文件写入
|
|
26
|
+
|
|
27
|
+
import urllib.request
|
|
28
|
+
import http.cookiejar
|
|
29
|
+
|
|
30
|
+
url = 'http://www.zhihu.com'
|
|
31
|
+
# 声明CookieJar对象实例来保存cookie
|
|
32
|
+
cookie = http.cookiejar.MozillaCookieJar()
|
|
33
|
+
# 从文件中读取内容到cookie变量中
|
|
34
|
+
cookie.load('cookie.txt', ignore_discard=True, ignore_expires=True)
|
|
35
|
+
# 处理器
|
|
36
|
+
handler = urllib.request.HTTPCookieProcessor(cookie)
|
|
37
|
+
opener = urllib.request.build_opener(handler)
|
|
38
|
+
print(opener.open(url).read())
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
import urllib.request
|
|
42
|
+
import http.cookiejar
|
|
43
|
+
|
|
44
|
+
# 自动记住cookie
|
|
45
|
+
url = 'http://www.zhihu.com'
|
|
46
|
+
# 声明cookiejar的对象,存放cookie的容器
|
|
47
|
+
cookie = http.cookiejar.CookieJar()
|
|
48
|
+
handler = urllib.request.HTTPCookieProcessor(cookie)
|
|
49
|
+
opener = urllib.request.build_opener(handler)
|
|
50
|
+
response = opener.open(url)
|
|
51
|
+
# 获取状态码,如果是200表示成功
|
|
52
|
+
print(response.status)
|
|
53
|
+
# 读取网页内容
|
|
54
|
+
print(response.read().decode('utf-8'))
|
|
55
|
+
|
|
56
|
+
print("\n")
|
|
57
|
+
for item in cookie:
|
|
58
|
+
print(item.name + '=' + item.value)
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: echorev
|
|
3
|
+
Version: 0.0.8
|
|
4
|
+
Summary: a GUI tool to help you reverse your input text
|
|
5
|
+
Home-page: https://github.com/cycleuser/EchoRev
|
|
6
|
+
Author: cycleuser
|
|
7
|
+
Author-email: cycleuser@cycleuser.org
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: PyQt5
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
echorev/__init__.py
|
|
5
|
+
echorev/get.png
|
|
6
|
+
echorev/getB.py
|
|
7
|
+
echorev/github.png
|
|
8
|
+
echorev/icon.png
|
|
9
|
+
echorev/quit.png
|
|
10
|
+
echorev/setup.py
|
|
11
|
+
echorev/test.py
|
|
12
|
+
echorev/tmp.py
|
|
13
|
+
echorev/update.png
|
|
14
|
+
echorev.egg-info/PKG-INFO
|
|
15
|
+
echorev.egg-info/SOURCES.txt
|
|
16
|
+
echorev.egg-info/dependency_links.txt
|
|
17
|
+
echorev.egg-info/requires.txt
|
|
18
|
+
echorev.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PyQt5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
echorev
|
echorev-0.0.8/setup.cfg
ADDED
echorev-0.0.8/setup.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#coding:utf-8
|
|
3
|
+
import os
|
|
4
|
+
from distutils.core import setup
|
|
5
|
+
from echorev import *
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
README = open(os.path.join(here, 'README.md')).read()
|
|
12
|
+
except:
|
|
13
|
+
README = 'https://github.com/cycleuser/EchoRev/blob/master/README.md'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
setup(name='echorev',
|
|
17
|
+
version=version,
|
|
18
|
+
description='a GUI tool to help you reverse your input text',
|
|
19
|
+
longdescription=README,
|
|
20
|
+
author='cycleuser',
|
|
21
|
+
author_email='cycleuser@cycleuser.org',
|
|
22
|
+
url='https://github.com/cycleuser/EchoRev',
|
|
23
|
+
packages=['echorev'],
|
|
24
|
+
package_data={
|
|
25
|
+
'echorev': ['*.py','*.png','*.qm','*.ttf','*.ini','*.md'],
|
|
26
|
+
},
|
|
27
|
+
include_package_data=True,
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
install_requires=[
|
|
31
|
+
'PyQt5',
|
|
32
|
+
],
|
|
33
|
+
)
|