nc-user-terminator 0.1.5__py3-none-any.whl → 0.1.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 nc-user-terminator might be problematic. Click here for more details.

nc_user_manager/client.py CHANGED
@@ -14,7 +14,7 @@ DEFAULT_TTL = 3600
14
14
  class OAuthClient:
15
15
  def __init__(
16
16
  self,
17
- base_url: str,
17
+ base_url: Optional[str],
18
18
  product_code: str,
19
19
  redirect_url: Optional[str] = None,
20
20
  single_session: bool = False,
@@ -28,6 +28,8 @@ class OAuthClient:
28
28
  :param redirect_url: 可选,重定向地址
29
29
  :param single_session: 是否单会话登录
30
30
  """
31
+ if not base_url:
32
+ base_url = "http://172.27.92.74"
31
33
  self._base_url = base_url.rstrip("/")
32
34
  self._product_code = product_code
33
35
  self._redirect_url = redirect_url
@@ -43,7 +45,10 @@ class OAuthClient:
43
45
  return await asyncio.to_thread(request, *args, **kwargs)
44
46
 
45
47
  def _headers(self, extra: Optional[Dict[str, str]] = None) -> Dict[str, str]:
46
- headers = {PRODUCT_HEADER: self._product_code}
48
+ headers = {
49
+ PRODUCT_HEADER: self._product_code,
50
+ "Host": "auth.nc.com"
51
+ }
47
52
  if extra:
48
53
  headers.update(extra)
49
54
  return headers
@@ -277,17 +282,11 @@ async def main():
277
282
 
278
283
  redis_cache = AsyncRedisCache(_redis)
279
284
 
280
- client = OAuthClient("http://localhost:8000/", "bankgpt", "http://localhost:8000/auth/google/custom_callback", single_session=True, cache=redis_cache)
281
- # authorize = client.authorize("google")
282
- # print(authorize)
285
+ client = OAuthClient("http://auth.nc.com/", "bankgpt", "http://localhost:8000/auth/google/custom_callback", single_session=True, cache=redis_cache)
286
+ authorize = client.authorize("google")
287
+ print(authorize)
283
288
 
284
289
 
285
- name = await client.say_my_name_async("Tu72u4SVue4ezadi1v5Ui9r9HjxH7YqbkY_yf5jFtPQ")
286
- print(name)
287
- name = await client.say_my_name_async("Tu72u4SVue4ezadi1v5Ui9r9HjxH7YqbkY_yf5jFtPQ")
288
- print(name)
289
- name = await client.logout_async("Tu72u4SVue4ezadi1v5Ui9r9HjxH7YqbkY_yf5jFtPQ")
290
- print(name)
291
290
 
292
291
 
293
292
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nc-user-terminator
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: OAuth client wrapper for multi-tenant projects
5
5
  Author: bw_song
6
6
  Author-email: m132777096902@gmail.com
@@ -13,3 +13,7 @@ Dynamic: requires-python
13
13
  # 更新
14
14
  + V0.1.5
15
15
  - 新增本地缓存机制
16
+ + v0.1.6
17
+ - 默认连接地址
18
+ + v0.1.7
19
+ - 映射host
@@ -1,10 +1,10 @@
1
1
  nc_user_manager/__init__.py,sha256=fF3FZD0XUW5YCfTbBeJs3RK-Mnm3IQ7lns6Eb_tMqPU,238
2
2
  nc_user_manager/cache.py,sha256=u9ioXDwHmEJHRB4VKI4JU_pp-8Y5O4bLPm8-pwqiMVc,2273
3
- nc_user_manager/client.py,sha256=71pQ_4YZy1f_BJ9Pc2Md1r57SStqI1qRxnXU9IGAm5Y,11276
3
+ nc_user_manager/client.py,sha256=Ly4OKny-IndK2Q6yOm1vP-dM3aXAALRSzbJrm4zNeiM,11095
4
4
  nc_user_manager/exceptions.py,sha256=yUMDrh1HHZF36UUadQNHvJlDgEYSYoYOObs8Q11fjrE,351
5
5
  nc_user_manager/models.py,sha256=mDK7zskIcaThxvUUTWVf6eMasw7YaA3hDGVVSd1ZJgo,1088
6
6
  nc_user_manager/utils.py,sha256=gxFSaUq0oiymIlvHITu2L7EkU2ZYQmW2q_okmUxGBeU,2319
7
- nc_user_terminator-0.1.5.dist-info/METADATA,sha256=1uCPVZ-m6nHokYebpNHDAdgJbtNxxJxugWNvzmqxm1U,378
8
- nc_user_terminator-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- nc_user_terminator-0.1.5.dist-info/top_level.txt,sha256=kOAUtl6RYo-x3vMJL8It3KCJLoIFPvMUiAAyXjPQTYA,16
10
- nc_user_terminator-0.1.5.dist-info/RECORD,,
7
+ nc_user_terminator-0.1.7.dist-info/METADATA,sha256=swVnTFl7hZIILw-5oULdVu9GtdRGe_8FBQD5cyqkBro,438
8
+ nc_user_terminator-0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ nc_user_terminator-0.1.7.dist-info/top_level.txt,sha256=kOAUtl6RYo-x3vMJL8It3KCJLoIFPvMUiAAyXjPQTYA,16
10
+ nc_user_terminator-0.1.7.dist-info/RECORD,,