lazyad 0.0.6__py3-none-any.whl → 0.0.7__py3-none-any.whl

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/__init__.py CHANGED
@@ -1 +1,2 @@
1
1
  from . import crawlers
2
+ from . import open
File without changes
lazyad/open/qq.py ADDED
@@ -0,0 +1,68 @@
1
+ import time
2
+ import random
3
+ import json
4
+ from lazysdk import lazyrequests
5
+
6
+ """
7
+ 2024-04-11 全面升级至3.0版本 https://developers.e.qq.com/v3.0/docs/api
8
+ """
9
+
10
+
11
+ def make_nonce():
12
+ """
13
+ 参考示例代码的生成一个随机数
14
+ :return:
15
+ """
16
+ return str(time.time()) + str(random.randint(0, 999999))
17
+
18
+
19
+ def oauth_token(
20
+ access_token,
21
+ app_id,
22
+ app_secret,
23
+ grant_type='authorization_code',
24
+ auth_code=None,
25
+ refresh_token=None,
26
+ redirect_uri=None
27
+ ):
28
+ """
29
+ 获取/刷新token
30
+ 相关文档:https://developers.e.qq.com/v3.0/docs/api/oauth/token
31
+ :param access_token:
32
+ :param auth_code:
33
+ :param app_id:
34
+ :param app_secret:
35
+ :param grant_type: 请求的类型,可选值:authorization_code(授权码方式获取 token)、refresh_token(刷新 token)
36
+ :param refresh_token:
37
+ :param redirect_uri:
38
+ :return:
39
+ """
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
+ url = 'https://api.e.qq.com/v3.0/oauth/token'
44
+ params = {
45
+ 'access_token': access_token,
46
+ 'timestamp': int(time.time()),
47
+ 'nonce': make_nonce,
48
+
49
+ 'client_id': app_id,
50
+ 'client_secret': app_secret,
51
+ 'grant_type': grant_type
52
+ }
53
+ if auth_code:
54
+ params['authorization_code'] = auth_code
55
+ if refresh_token:
56
+ params['refresh_token'] = refresh_token
57
+ if redirect_uri:
58
+ params['redirect_uri'] = redirect_uri
59
+
60
+ for k in params:
61
+ if type(params[k]) is not str:
62
+ params[k] = json.dumps(params[k])
63
+
64
+ return lazyrequests.lazy_requests(
65
+ method="GET",
66
+ url=url,
67
+ params=params
68
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -0,0 +1,11 @@
1
+ lazyad/__init__.py,sha256=tnVTFEgdzgMWQI0mZqy3DAueMJjpypPb15DdxJ-9TiU,41
2
+ lazyad/crawlers/__init__.py,sha256=GK3GGpiUJbESc1uGTwSmEnsSUwYDNZfJCxeLYB4CpS4,68
3
+ lazyad/crawlers/chuangliang.py,sha256=mVlfN5fipQdRc6STuC0B68ntGCU23I1PF2sD5q2jncg,1482
4
+ lazyad/crawlers/oceanengine.py,sha256=kjBEpCb_h5OpodCTqzvXd5MBBwAuw3Oq5UKWoTCXrQM,4540
5
+ lazyad/crawlers/qq.py,sha256=5W5xVOmRtYRBhuFtrbX9XcrdmgeiV71zIIAtqF44io4,3060
6
+ lazyad/open/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ lazyad/open/qq.py,sha256=5fZdnizaaACBhhpP4IG4iPAQCG-pZ9L-oLNgcey5qCI,1780
8
+ lazyad-0.0.7.dist-info/METADATA,sha256=qbQma-IHYQQel6SHraDXey65QeQ9Zq1MGvtpqvUQW6Y,1694
9
+ lazyad-0.0.7.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
10
+ lazyad-0.0.7.dist-info/top_level.txt,sha256=RAPjtj4gZYpsKAM3fAQrWyyn84xjdRuaiUS76gx6eNs,7
11
+ lazyad-0.0.7.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- lazyad/__init__.py,sha256=ELZ9AH9-9Y32cf_jgHhvgEKGVOyKhRDCxHNLfiHB1sY,23
2
- lazyad/crawlers/__init__.py,sha256=GK3GGpiUJbESc1uGTwSmEnsSUwYDNZfJCxeLYB4CpS4,68
3
- lazyad/crawlers/chuangliang.py,sha256=mVlfN5fipQdRc6STuC0B68ntGCU23I1PF2sD5q2jncg,1482
4
- lazyad/crawlers/oceanengine.py,sha256=kjBEpCb_h5OpodCTqzvXd5MBBwAuw3Oq5UKWoTCXrQM,4540
5
- lazyad/crawlers/qq.py,sha256=5W5xVOmRtYRBhuFtrbX9XcrdmgeiV71zIIAtqF44io4,3060
6
- lazyad-0.0.6.dist-info/METADATA,sha256=LZJV5_lthTjd-pnrGmaZs3aKQlkuinBvXoISUo8ULhI,1694
7
- lazyad-0.0.6.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
8
- lazyad-0.0.6.dist-info/top_level.txt,sha256=RAPjtj4gZYpsKAM3fAQrWyyn84xjdRuaiUS76gx6eNs,7
9
- lazyad-0.0.6.dist-info/RECORD,,
File without changes