http-misc 1.0.3__tar.gz → 1.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: http-misc
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Утилитарный пакет межсервисного взаимодействия по протоколу HTTP
5
5
  Author: Anton Gorinenko
6
6
  Author-email: anton.gorinenko@gmail.com
@@ -4,7 +4,7 @@ from abc import abstractmethod, ABC
4
4
 
5
5
  class TokenCache(ABC):
6
6
  @abstractmethod
7
- def set_token(self, cache_key: str, access_token: str, expires_in: datetime):
7
+ def set_token(self, cache_key: str, access_token: str, expires_in: datetime.datetime):
8
8
  pass
9
9
 
10
10
  @abstractmethod
@@ -17,9 +17,16 @@ class TokenCache(ABC):
17
17
 
18
18
 
19
19
  class MemoryTokenCache(TokenCache):
20
- """ Класс, реализующий хранение access_token в памяти """
20
+ """ Класс, реализующий хранение access_token в памяти.
21
+ Обратите внимание, что если ключом является client_id, то memory_cache не может быть одним на все запросы,
22
+ тк у разных запросов могут быть разные разрешения scopes
23
+ """
21
24
 
22
- def set_token(self, cache_key: str, access_token: str, expires_in: datetime):
25
+ # memory_cache = {}
26
+ def __init__(self):
27
+ self.memory_cache = {}
28
+
29
+ def set_token(self, cache_key: str, access_token: str, expires_in: datetime.datetime):
23
30
  """ Установка токенов """
24
31
  cache_value = {'access_token': access_token, 'expires_in': expires_in}
25
32
 
@@ -34,5 +41,3 @@ class MemoryTokenCache(TokenCache):
34
41
  def remove(self, cache_key: str):
35
42
  if cache_key in self.memory_cache:
36
43
  self.memory_cache.pop(cache_key)
37
-
38
- memory_cache = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: http-misc
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Утилитарный пакет межсервисного взаимодействия по протоколу HTTP
5
5
  Author: Anton Gorinenko
6
6
  Author-email: anton.gorinenko@gmail.com
@@ -4,7 +4,7 @@ import setuptools
4
4
 
5
5
  setuptools.setup(
6
6
  name='http-misc',
7
- version='1.0.3',
7
+ version='1.0.4',
8
8
  author='Anton Gorinenko',
9
9
  author_email='anton.gorinenko@gmail.com',
10
10
  description='Утилитарный пакет межсервисного взаимодействия по протоколу HTTP',
@@ -23,7 +23,7 @@ async def test_set_system_oauth_token(mocker):
23
23
  client_id='6x7ujMdws6tDLbpePzQZvkYd0yFADYNJ11putMRw',
24
24
  client_secret='RgCUfgtFHxqZ2amnqS4eTFL6cRsdfc3YYN0lTBrAIarLrt0Icewv6QzC1nFZXusEjqpG0aFmC14f8Jme4z3Q4TpxI9UQM5aU5LQkvuKpOoZ3oF2wDlyC7J41zPGTYuhO',
25
25
  scope='read write',
26
- token_url='http://iam.dev.zaobe.cloud:8008/api/v1/oauth/token/',
26
+ token_url='http://localhost/api/v1/oauth/token/',
27
27
  token_cache=cache.MemoryTokenCache())
28
28
 
29
29
  request = {
File without changes
File without changes
File without changes
File without changes