lazyad 0.0.7__tar.gz → 0.0.9__tar.gz
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.
Potentially problematic release.
This version of lazyad might be problematic. Click here for more details.
- {lazyad-0.0.7 → lazyad-0.0.9}/PKG-INFO +1 -1
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad/open/qq.py +50 -6
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad.egg-info/PKG-INFO +1 -1
- {lazyad-0.0.7 → lazyad-0.0.9}/setup.py +1 -1
- {lazyad-0.0.7 → lazyad-0.0.9}/README.md +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad/__init__.py +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad/crawlers/__init__.py +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad/crawlers/chuangliang.py +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad/crawlers/oceanengine.py +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad/crawlers/qq.py +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad/open/__init__.py +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad.egg-info/SOURCES.txt +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad.egg-info/dependency_links.txt +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad.egg-info/requires.txt +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/lazyad.egg-info/top_level.txt +0 -0
- {lazyad-0.0.7 → lazyad-0.0.9}/setup.cfg +0 -0
|
@@ -16,14 +16,60 @@ def make_nonce():
|
|
|
16
16
|
return str(time.time()) + str(random.randint(0, 999999))
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def oauth_token2(
|
|
20
|
+
app_id,
|
|
21
|
+
app_secret,
|
|
22
|
+
redirect_uri,
|
|
23
|
+
grant_type='authorization_code',
|
|
24
|
+
auth_code=None,
|
|
25
|
+
refresh_token=None,
|
|
26
|
+
):
|
|
27
|
+
"""
|
|
28
|
+
OAuth 2.0 授权
|
|
29
|
+
获取/刷新token
|
|
30
|
+
相关文档:https://developers.e.qq.com/docs/start/authorization
|
|
31
|
+
:param auth_code:
|
|
32
|
+
:param app_id:
|
|
33
|
+
:param app_secret:
|
|
34
|
+
:param grant_type: 请求的类型,可选值:authorization_code(授权码方式获取 token)、refresh_token(刷新 token)
|
|
35
|
+
:param refresh_token:
|
|
36
|
+
:param redirect_uri:
|
|
37
|
+
:return:
|
|
38
|
+
"""
|
|
39
|
+
redirect_uri = f'{redirect_uri}?app_id={app_id}'
|
|
40
|
+
|
|
41
|
+
url = 'https://api.e.qq.com/oauth/token'
|
|
42
|
+
params = {
|
|
43
|
+
'client_id': app_id,
|
|
44
|
+
'client_secret': app_secret,
|
|
45
|
+
'grant_type': grant_type
|
|
46
|
+
}
|
|
47
|
+
if auth_code:
|
|
48
|
+
params['authorization_code'] = auth_code
|
|
49
|
+
if refresh_token:
|
|
50
|
+
params['refresh_token'] = refresh_token
|
|
51
|
+
if redirect_uri:
|
|
52
|
+
params['redirect_uri'] = redirect_uri
|
|
53
|
+
|
|
54
|
+
for k in params:
|
|
55
|
+
if type(params[k]) is not str:
|
|
56
|
+
params[k] = json.dumps(params[k])
|
|
57
|
+
|
|
58
|
+
return lazyrequests.lazy_requests(
|
|
59
|
+
method="GET",
|
|
60
|
+
url=url,
|
|
61
|
+
params=params
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def oauth_token3(
|
|
20
66
|
access_token,
|
|
21
67
|
app_id,
|
|
22
68
|
app_secret,
|
|
69
|
+
redirect_uri=None,
|
|
23
70
|
grant_type='authorization_code',
|
|
24
71
|
auth_code=None,
|
|
25
72
|
refresh_token=None,
|
|
26
|
-
redirect_uri=None
|
|
27
73
|
):
|
|
28
74
|
"""
|
|
29
75
|
获取/刷新token
|
|
@@ -34,12 +80,9 @@ def oauth_token(
|
|
|
34
80
|
:param app_secret:
|
|
35
81
|
:param grant_type: 请求的类型,可选值:authorization_code(授权码方式获取 token)、refresh_token(刷新 token)
|
|
36
82
|
:param refresh_token:
|
|
37
|
-
:param redirect_uri:
|
|
83
|
+
:param redirect_uri: 回调地址
|
|
38
84
|
:return:
|
|
39
85
|
"""
|
|
40
|
-
if grant_type and not redirect_uri:
|
|
41
|
-
redirect_uri = f'https://open.fanshang888.com/api/cache/receive/open_api/ad/ad_developer/qq/callback?app_id={app_id}'
|
|
42
|
-
|
|
43
86
|
url = 'https://api.e.qq.com/v3.0/oauth/token'
|
|
44
87
|
params = {
|
|
45
88
|
'access_token': access_token,
|
|
@@ -55,6 +98,7 @@ def oauth_token(
|
|
|
55
98
|
if refresh_token:
|
|
56
99
|
params['refresh_token'] = refresh_token
|
|
57
100
|
if redirect_uri:
|
|
101
|
+
redirect_uri = f'{redirect_uri}?app_id={app_id}'
|
|
58
102
|
params['redirect_uri'] = redirect_uri
|
|
59
103
|
|
|
60
104
|
for k in params:
|
|
@@ -13,7 +13,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
|
|
|
13
13
|
|
|
14
14
|
setuptools.setup(
|
|
15
15
|
name="lazyad",
|
|
16
|
-
version="0.0.
|
|
16
|
+
version="0.0.9",
|
|
17
17
|
description="基于Python的懒人包-适用于广告投放模块",
|
|
18
18
|
long_description=long_description,
|
|
19
19
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|