lazyad 0.0.10__tar.gz → 0.0.12__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.10
3
+ Version: 0.0.12
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -1,7 +1,8 @@
1
- import time
1
+ from lazysdk import lazyrequests
2
2
  import random
3
+ import time
3
4
  import json
4
- from lazysdk import lazyrequests
5
+
5
6
 
6
7
  """
7
8
  2024-04-11 全面升级至3.0版本 https://developers.e.qq.com/v3.0/docs/api
@@ -63,10 +64,10 @@ def oauth_token2(
63
64
 
64
65
 
65
66
  def oauth_token3(
66
- access_token,
67
67
  app_id,
68
68
  app_secret,
69
69
  redirect_uri=None,
70
+ access_token=None,
70
71
  grant_type='authorization_code',
71
72
  auth_code=None,
72
73
  refresh_token=None,
@@ -83,16 +84,20 @@ def oauth_token3(
83
84
  :param redirect_uri: 回调地址
84
85
  :return:
85
86
  """
86
- url = 'https://api.e.qq.com/v3.0/oauth/token'
87
+ # url = 'https://api.e.qq.com/v3.0/oauth/token'
87
88
  params = {
88
- 'access_token': access_token,
89
- 'timestamp': int(time.time()),
90
- 'nonce': make_nonce,
91
-
92
89
  'client_id': app_id,
93
90
  'client_secret': app_secret,
94
91
  'grant_type': grant_type
95
92
  }
93
+ if access_token:
94
+ # OAuth 相关接口无需提供 access_token、timestamp、nonce 等通用请求参数。
95
+ params['access_token'] = access_token
96
+ params['timestamp'] = int(time.time())
97
+ params['nonce'] = make_nonce()
98
+ url = 'https://api.e.qq.com/v3.0/oauth/token'
99
+ else:
100
+ url = 'https://api.e.qq.com/oauth/token'
96
101
  if auth_code:
97
102
  params['authorization_code'] = auth_code
98
103
  if refresh_token:
@@ -101,10 +106,6 @@ def oauth_token3(
101
106
  redirect_uri = f'{redirect_uri}?app_id={app_id}'
102
107
  params['redirect_uri'] = redirect_uri
103
108
 
104
- # for k in params:
105
- # if type(params[k]) is not str:
106
- # params[k] = json.dumps(params[k])
107
-
108
109
  return lazyrequests.lazy_requests(
109
110
  method="GET",
110
111
  url=url,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.10
3
+ Version: 0.0.12
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -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.10",
16
+ version="0.0.12",
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