feat: end-point for bill of payment generation
This commit is contained in:
61
test.py
61
test.py
@@ -1,54 +1,25 @@
|
||||
# import asyncio
|
||||
#
|
||||
# from dict_hash import dict_hash
|
||||
# from sqlalchemy.ext.asyncio import AsyncSession
|
||||
#
|
||||
# from backend.session import session_maker
|
||||
# from marketplaces import MarketplaceControllerFactory
|
||||
# from models import Marketplace
|
||||
# import pickle
|
||||
# pickle.dumps()
|
||||
#
|
||||
# async def main():
|
||||
# a = "example"
|
||||
# b = "example"
|
||||
#
|
||||
# print(hash(a)) # Хэш для строки "example"
|
||||
# print(hash(b)) # Хэш для строки "example", будет таким же как и у a
|
||||
#
|
||||
# return
|
||||
# session: AsyncSession = session_maker()
|
||||
#
|
||||
# try:
|
||||
# mp = await session.get(Marketplace, 2)
|
||||
# if not mp:
|
||||
# return
|
||||
# c = MarketplaceControllerFactory.get_controller(session, mp)
|
||||
# await c.synchronize_products()
|
||||
# finally:
|
||||
# await session.close()
|
||||
#
|
||||
#
|
||||
# if __name__ == '__main__':
|
||||
# loop = asyncio.get_event_loop()
|
||||
# loop.run_until_complete(main())
|
||||
import hashlib
|
||||
import time
|
||||
import asyncio
|
||||
|
||||
from reportlab.rl_settings import autoGenerateMissingTTFName
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from decorators.locking import lock, redis_client
|
||||
from backend.session import session_maker
|
||||
from services.billing import BillingService
|
||||
|
||||
|
||||
@lock('synchronize_marketplace', include_args_in_key=True)
|
||||
def test(marketplace_id: int):
|
||||
print("test")
|
||||
time.sleep(100)
|
||||
async def main():
|
||||
session: AsyncSession = session_maker()
|
||||
|
||||
try:
|
||||
service = BillingService(session)
|
||||
|
||||
def main():
|
||||
test(1)
|
||||
pdf_file = await service.create_billing_document_pdf(121)
|
||||
|
||||
with open("report.pdf", "wb") as f:
|
||||
f.write(pdf_file.getvalue())
|
||||
finally:
|
||||
await session.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
|
||||
Reference in New Issue
Block a user