yeref 0.29.28__tar.gz → 0.29.30__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: yeref
3
- Version: 0.29.28
3
+ Version: 0.29.30
4
4
  Summary: desc-f
5
5
  Author: john smith
6
6
  Dynamic: author
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name='yeref',
5
- version='0.29.28',
5
+ version='0.29.30',
6
6
  description='desc-f',
7
7
  author='john smith',
8
8
  packages=['yeref'],
@@ -7753,13 +7753,14 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7753
7753
  page = data.get('page', '')
7754
7754
  connectedAddress = data.get('connectedAddress', '')
7755
7755
  USER_TID = chat_id
7756
- USER_HID = USER_LZ = None
7756
+ USER_HID = USER_LZ = USER_DT = None
7757
7757
  USER_VARS = json.loads(USER_VARS_)
7758
7758
  USER_LSTS = json.loads(USER_LSTS_)
7759
7759
  USER_GAMES = {}
7760
7760
  balls = 1
7761
7761
  is_paid = False
7762
7762
  till_paid = ''
7763
+ now_ = datetime.now(timezone.utc)
7763
7764
 
7764
7765
  print(f"upd_user_data_main: {lc=}, {USER_LSTS=}")
7765
7766
  try:
@@ -7793,14 +7794,14 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7793
7794
  elif lc in ['ru', 'kz', 'kg', 'uz', 'tm', 'md', 'am', 'uk-UA', 'uk', 'kk', 'tk', 'ky']:
7794
7795
  lz = 'ru'
7795
7796
  USER_LZ = lz
7796
- if not USER_VARS.get('USER_DT', None):
7797
+ if not USER_DT:
7798
+ USER_DT = now_
7797
7799
  USER_VARS['USER_DT'] = USER_DT.strftime("%d-%m-%Y_%H-%M-%S")
7798
7800
  USER_HID = hashlib.blake2b(f"{'tid'}-{chat_id}".encode('utf-8'), digest_size=4).hexdigest()
7799
7801
  if utm: USER_VARS['USER_UTM'] = utm
7800
7802
 
7801
- now = datetime.now(timezone.utc)
7802
- USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
7803
- USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
7803
+ USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now_.strftime('%Y-%m-%d')]))
7804
+ USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now_.strftime('%Y-%m')]))
7804
7805
  USER_VARS['USER_SIG'] = usr_sig
7805
7806
  USER_VARS['USER_ISPREMIUM'] = is_premium
7806
7807
  USER_VARS['USER_LZ'] = USER_LZ
@@ -7862,9 +7863,9 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7862
7863
  sql = f"""
7863
7864
  INSERT INTO \"USER\" (
7864
7865
  USER_TID, USER_HID, USER_USERNAME, USER_FULLNAME, USER_ISPREMIUM,
7865
- USER_LZ, USER_GAMES, USER_VARS, USER_LSTS
7866
+ USER_LZ, USER_DT, USER_GAMES, USER_VARS, USER_LSTS
7866
7867
  )
7867
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
7868
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
7868
7869
  ON CONFLICT (USER_TID) DO UPDATE
7869
7870
  SET
7870
7871
  USER_HID = EXCLUDED.USER_HID,
@@ -7877,7 +7878,7 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
7877
7878
  USER_VARS = EXCLUDED.USER_VARS,
7878
7879
  USER_LSTS = EXCLUDED.USER_LSTS
7879
7880
  """
7880
- await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ,
7881
+ await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ, USER_DT,
7881
7882
  json.dumps(USER_GAMES, ensure_ascii=False),
7882
7883
  json.dumps(USER_VARS, ensure_ascii=False),
7883
7884
  json.dumps(USER_LSTS, ensure_ascii=False),), BASE_P)
@@ -7901,11 +7902,12 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
7901
7902
  page = data.get('page', '')
7902
7903
  connectedAddress = data.get('connectedAddress', '')
7903
7904
  USER_TID = chat_id
7904
- USER_HID = USER_LZ = None
7905
+ USER_HID = USER_LZ = USER_DT = None
7905
7906
  USER_VARS = json.loads(USER_VARS_)
7906
7907
  USER_LSTS = json.loads(USER_LSTS_)
7907
7908
  USER_GAMES = {}
7908
7909
  balls = 1
7910
+ now_ = datetime.now(timezone.utc)
7909
7911
 
7910
7912
  print(f"upd_user_data: {USER_LSTS=}")
7911
7913
  try:
@@ -7950,13 +7952,15 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
7950
7952
  elif lc in ['ru', 'kz', 'kg', 'uz', 'tm', 'md', 'am', 'uk-UA', 'uk', 'kk', 'tk', 'ky']:
7951
7953
  lz = 'ru'
7952
7954
  USER_LZ = lz
7953
- if not USER_VARS.get('USER_DT', None):
7955
+ if not USER_DT:
7956
+ USER_DT = now_
7954
7957
  USER_VARS['USER_DT'] = USER_DT.strftime("%d-%m-%Y_%H-%M-%S")
7958
+ USER_HID = hashlib.blake2b(f"{'tid'}-{chat_id}".encode('utf-8'), digest_size=4).hexdigest()
7959
+ if req_url: USER_VARS['USER_UTM'] = req_url
7955
7960
  if not USER_HID: USER_HID = hashlib.blake2b(f"{tid}-{chat_id}".encode('utf-8'), digest_size=4).hexdigest()
7956
7961
 
7957
- now = datetime.now(timezone.utc)
7958
- USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now.strftime('%Y-%m-%d')]))
7959
- USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now.strftime('%Y-%m')]))
7962
+ USER_LSTS["USER_DAU"] = list(set(USER_LSTS.get("USER_DAU", []) + [now_.strftime('%Y-%m-%d')]))
7963
+ USER_LSTS["USER_MAU"] = list(set(USER_LSTS.get("USER_MAU", []) + [now_.strftime('%Y-%m')]))
7960
7964
  USER_VARS['USER_SIG'] = usr_sig
7961
7965
  USER_VARS['USER_ISPREMIUM'] = is_premium
7962
7966
  USER_VARS['USER_LZ'] = USER_LZ
@@ -7988,9 +7992,9 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
7988
7992
  sql = f"""
7989
7993
  INSERT INTO {schema_name}_{tid}.USER (
7990
7994
  USER_TID, USER_HID, USER_USERNAME, USER_FULLNAME, USER_ISPREMIUM,
7991
- USER_LZ, USER_GAMES, USER_VARS, USER_LSTS
7995
+ USER_LZ, USER_DT, USER_GAMES, USER_VARS, USER_LSTS
7992
7996
  )
7993
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
7997
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
7994
7998
  ON CONFLICT (USER_TID) DO UPDATE
7995
7999
  SET
7996
8000
  USER_HID = EXCLUDED.USER_HID,
@@ -8003,7 +8007,7 @@ async def upd_user_data(ENT_TID, data, web_app_init_data, PROJECT_USERNAME, BASE
8003
8007
  USER_VARS = EXCLUDED.USER_VARS,
8004
8008
  USER_LSTS = EXCLUDED.USER_LSTS
8005
8009
  """
8006
- await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ,
8010
+ await db_change_pg(sql, (USER_TID, USER_HID, username, full_name, is_premium, USER_LZ, USER_DT,
8007
8011
  json.dumps(USER_GAMES, ensure_ascii=False),
8008
8012
  json.dumps(USER_VARS, ensure_ascii=False),
8009
8013
  json.dumps(USER_LSTS, ensure_ascii=False),), BASE_P)
@@ -18886,6 +18890,24 @@ async def set_privacy(app):
18886
18890
 
18887
18891
 
18888
18892
  # region google
18893
+ async def normalize_rows(rows):
18894
+ out = []
18895
+ for row in rows:
18896
+ new_row = []
18897
+ iterable = row.values() if hasattr(row, "values") else row
18898
+ for c in iterable:
18899
+ if isinstance(c, datetime.datetime):
18900
+ new_row.append(c.isoformat())
18901
+ elif isinstance(c, (dict, list)):
18902
+ new_row.append(json.dumps(c, ensure_ascii=False))
18903
+ elif c is None:
18904
+ new_row.append("")
18905
+ else:
18906
+ new_row.append(str(c))
18907
+ out.append(new_row)
18908
+ return out
18909
+
18910
+
18889
18911
  async def api_sync_all(value_many, spreadsheet_id, CONF_P, EXTRA_D, range_many='A2', sheet_id='Sheet1',
18890
18912
  value_input_option='USER_ENTERED', major_dimension="ROWS"):
18891
18913
  scopes = r_conf('scopes', CONF_P)
@@ -18894,12 +18916,23 @@ async def api_sync_all(value_many, spreadsheet_id, CONF_P, EXTRA_D, range_many='
18894
18916
  http_auth = credentials.authorize(httplib2.Http())
18895
18917
  sheets_service = build('sheets', 'v4', http=http_auth, cache_discovery=False)
18896
18918
 
18897
- convert_value = []
18898
- for item in value_many:
18899
- convert_value.append(list(item))
18900
-
18901
- await api_write_cells(sheets_service, convert_value, range_many, spreadsheet_id, sheet_id, value_input_option,
18902
- major_dimension)
18919
+ # convert_value = []
18920
+ # for item in value_many:
18921
+ # convert_value.append(list(item))
18922
+ #
18923
+ # await api_write_cells(sheets_service, convert_value, range_many, spreadsheet_id, sheet_id, value_input_option, major_dimension)
18924
+ prepared = await normalize_rows([list(item) for item in value_many])
18925
+ # print(f"{convert_value=}")
18926
+
18927
+ await api_write_cells(
18928
+ sheets_service,
18929
+ convert_value,
18930
+ range_many,
18931
+ spreadsheet_id,
18932
+ sheet_id,
18933
+ value_input_option,
18934
+ major_dimension
18935
+ )
18903
18936
 
18904
18937
 
18905
18938
  async def api_sync_update(value_many, spreadsheet_id, range_many, CONF_P, EXTRA_D, sheet_id='Sheet1',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yeref
3
- Version: 0.29.28
3
+ Version: 0.29.30
4
4
  Summary: desc-f
5
5
  Author: john smith
6
6
  Dynamic: author
File without changes
File without changes
File without changes
File without changes
File without changes