This commit is contained in:
2025-04-19 20:23:37 +02:00
commit 5d70fe1ba2
11 changed files with 255 additions and 0 deletions

43
send_daily_msg copy.py Normal file
View File

@@ -0,0 +1,43 @@
import httpx
import asyncio
import sqlite3
import json
url = 'http://94.177.199.207:3000/client'
session = 'AssistenzaPubblicaBardiProd'
async def fetch(client, url):
response = await client.get(url)
return response.json()
def getContactList():
api = f'{url}/getContacts/{session}'
with httpx.Client() as client:
response = client.get(api)
return response.json()
async def main():
contactList = getContactList()
print(type(contactList))
'''
async with httpx.AsyncClient() as client:
tasks = fetch(client, url)
results = await asyncio.gather(*tasks)
for result in results:
print(result)
'''
for contact in contactList["contacts"]:
print("\nDettagli contatto:")
print(f"Numero: {contact.get('number', 'N/A')}")
print(f"Nome: {contact.get('name', 'N/A')}")
print(f"Pushname: {contact.get('pushname', 'N/A')}")
print(f"ShortName: {contact.get('shortName', 'N/A')}")
print(f"Server ID: {contact['id']['server']}")
print(f"User ID: {contact['id']['user']}")
print(f"serialized: {contact['id']['_serialized']}")
if __name__ == '__main__':
asyncio.run(main())