diff --git a/auto_email/__pycache__/__init__.cpython-310.pyc b/auto_email/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 4bc7ce6..0000000 Binary files a/auto_email/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/auto_email/__pycache__/admin.cpython-310.pyc b/auto_email/__pycache__/admin.cpython-310.pyc deleted file mode 100644 index 0812ea6..0000000 Binary files a/auto_email/__pycache__/admin.cpython-310.pyc and /dev/null differ diff --git a/auto_email/__pycache__/apps.cpython-310.pyc b/auto_email/__pycache__/apps.cpython-310.pyc deleted file mode 100644 index 60a5ff9..0000000 Binary files a/auto_email/__pycache__/apps.cpython-310.pyc and /dev/null differ diff --git a/auto_email/__pycache__/models.cpython-310.pyc b/auto_email/__pycache__/models.cpython-310.pyc deleted file mode 100644 index 47ba6c6..0000000 Binary files a/auto_email/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/auto_email/__pycache__/serializer.cpython-310.pyc b/auto_email/__pycache__/serializer.cpython-310.pyc deleted file mode 100644 index 73d6321..0000000 Binary files a/auto_email/__pycache__/serializer.cpython-310.pyc and /dev/null differ diff --git a/auto_email/__pycache__/views.cpython-310.pyc b/auto_email/__pycache__/views.cpython-310.pyc deleted file mode 100644 index bfcc096..0000000 Binary files a/auto_email/__pycache__/views.cpython-310.pyc and /dev/null differ diff --git a/auto_email/admin.py b/auto_email/admin.py deleted file mode 100755 index 01bd8d7..0000000 --- a/auto_email/admin.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.contrib import admin -from .models import * -admin.site.register(emails_creadentials) -admin.site.register(auto_email_function_errors) -admin.site.register(Mnf_Notification) \ No newline at end of file diff --git a/auto_email/apps.py b/auto_email/apps.py deleted file mode 100755 index f3550b0..0000000 --- a/auto_email/apps.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.apps import AppConfig - - -class AutoEmailConfig(AppConfig): - name = 'auto_email' diff --git a/auto_email/email/EMAILSheet39.xlsx b/auto_email/email/EMAILSheet39.xlsx deleted file mode 100644 index 13abb97..0000000 Binary files a/auto_email/email/EMAILSheet39.xlsx and /dev/null differ diff --git a/auto_email/email/EmailCredentials.xlsx b/auto_email/email/EmailCredentials.xlsx deleted file mode 100644 index 33a7e9c..0000000 Binary files a/auto_email/email/EmailCredentials.xlsx and /dev/null differ diff --git a/auto_email/email/sheetCodeExcel.xlsx b/auto_email/email/sheetCodeExcel.xlsx deleted file mode 100755 index dd614fa..0000000 Binary files a/auto_email/email/sheetCodeExcel.xlsx and /dev/null differ diff --git a/auto_email/migrations/0001_initial.py b/auto_email/migrations/0001_initial.py deleted file mode 100755 index eac28b1..0000000 --- a/auto_email/migrations/0001_initial.py +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by Django 4.1.13 on 2024-02-24 04:47 - -from django.db import migrations, models -import uuid - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='auto_email_function_errors', - fields=[ - ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), - ('email', models.EmailField(blank=True, max_length=254, null=True)), - ('error', models.TextField(blank=True, null=True)), - ('email_code', models.CharField(blank=True, max_length=150, null=True)), - ('key_value', models.TextField(blank=True, null=True)), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('updated_at', models.DateTimeField(auto_now=True)), - ], - ), - migrations.CreateModel( - name='emails_creadentials', - fields=[ - ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), - ('email', models.EmailField(blank=True, max_length=254, null=True)), - ('password', models.CharField(blank=True, max_length=250, null=True)), - ], - ), - migrations.CreateModel( - name='Mnf_Notification', - fields=[ - ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), - ('user', models.CharField(max_length=100)), - ('read', models.BooleanField(default=False)), - ('title', models.CharField(blank=True, max_length=200, null=True)), - ('service_name', models.CharField(blank=True, max_length=200, null=True)), - ('image_url', models.CharField(blank=True, max_length=200, null=True)), - ('created', models.DateTimeField(auto_now_add=True, null=True)), - ('updated', models.DateTimeField(auto_now=True, null=True)), - ], - ), - ] diff --git a/auto_email/migrations/__init__.py b/auto_email/migrations/__init__.py deleted file mode 100755 index e69de29..0000000 diff --git a/auto_email/models.py b/auto_email/models.py deleted file mode 100755 index 8fc8577..0000000 --- a/auto_email/models.py +++ /dev/null @@ -1,32 +0,0 @@ -from django.db import models -import uuid -# Create your models here. - - -class emails_creadentials(models.Model): - id = models.UUIDField(default=uuid.uuid4,editable=False,primary_key=True) - email = models.EmailField(max_length=254,null=True,blank=True) - password = models.CharField(max_length=250,null=True,blank=True) - - - -class auto_email_function_errors(models.Model): - id = models.UUIDField(primary_key=True,editable=False,default=uuid.uuid4) - email = models.EmailField(max_length=254,null=True,blank=True) - error = models.TextField(null=True,blank=True) - email_code = models.CharField( max_length=150,null=True,blank=True) - key_value = models.TextField(null=True,blank=True) - created_at = models.DateTimeField(auto_now_add=True) - updated_at = models.DateTimeField(auto_now=True) - - -class Mnf_Notification(models.Model): - id = models.UUIDField(primary_key=True,editable=False,default=uuid.uuid4) - user = models.CharField(max_length=100) - read = models.BooleanField(default = False) - title = models.CharField(max_length = 200,blank=True, null=True) - service_name = models.CharField(max_length = 200,blank=True, null=True) - image_url = models.CharField(max_length = 200,blank=True, null=True) - created = models.DateTimeField(auto_now_add=True,blank=True, null=True) - updated = models.DateTimeField(auto_now=True,blank=True, null=True) - diff --git a/auto_email/serializer.py b/auto_email/serializer.py deleted file mode 100755 index 7b1edd1..0000000 --- a/auto_email/serializer.py +++ /dev/null @@ -1,7 +0,0 @@ -from .models import * -from rest_framework import serializers - -class Mnf_NotificationSerializer(serializers.ModelSerializer): - class Meta: - model = Mnf_Notification - fields = '__all__' \ No newline at end of file diff --git a/auto_email/serializers.py b/auto_email/serializers.py deleted file mode 100755 index 7b1edd1..0000000 --- a/auto_email/serializers.py +++ /dev/null @@ -1,7 +0,0 @@ -from .models import * -from rest_framework import serializers - -class Mnf_NotificationSerializer(serializers.ModelSerializer): - class Meta: - model = Mnf_Notification - fields = '__all__' \ No newline at end of file diff --git a/auto_email/templates/email_template.html b/auto_email/templates/email_template.html deleted file mode 100755 index 5d970ee..0000000 --- a/auto_email/templates/email_template.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - Email Template - - - -
- - -

{{title1}}

-

{{title2}}

-
-
- -
-
- - {% load custom_filters %} - {% with pattern="\[(.*?)\]\((.*?)\)" %} - {% with modified_value=invitation|urlize_text|safe %} -

{{ modified_value|safe }}

- {% endwith %} - {% with modified_value=additional|urlize_text|safe %} -

{{ modified_value|safe }}

- {% endwith %} - {% endwith %} -
-
- -
- -
- -
- - \ No newline at end of file diff --git a/auto_email/templates/email_template_OLD.html b/auto_email/templates/email_template_OLD.html deleted file mode 100755 index a3e7b86..0000000 --- a/auto_email/templates/email_template_OLD.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - {% block message %} - - - - - - - - - - -
- - - - -
-
My Next Film
-
-
- - - - -
-

{{title1}}

-

{{title2}}

- -
-
- - - - - - - - -
- - - - - -
- {% load custom_filters %} - {% with pattern="\[(.*?)\]\((.*?)\)" %} - {% with modified_value=invitation|urlize_text|safe %} -

{{ modified_value|safe }}

- {% endwith %} - {% with modified_value=additional|urlize_text|safe %} -

{{ modified_value|safe }}

- {% endwith %} - {% endwith %} -
-
- {{poster}} -
-
-
-
- - - - -
- - - - -
-

For any related queries, please reach out to ."MY NEXT FILM PRIVATE LIMITED".

-
-
-
- {% endblock message %} - \ No newline at end of file diff --git a/auto_email/templatetags/__init__.py b/auto_email/templatetags/__init__.py deleted file mode 100755 index e69de29..0000000 diff --git a/auto_email/templatetags/custom_filters.py b/auto_email/templatetags/custom_filters.py deleted file mode 100755 index 909b495..0000000 --- a/auto_email/templatetags/custom_filters.py +++ /dev/null @@ -1,10 +0,0 @@ -from django import template -from django.utils.safestring import mark_safe -import re - -register = template.Library() - -@register.filter -def urlize_text(value): - url_pattern = re.compile(r'\[([^]]+)\]\(([^)]+)\)') - return mark_safe(url_pattern.sub(r'\1', value)) \ No newline at end of file diff --git a/auto_email/tests.py b/auto_email/tests.py deleted file mode 100755 index 7ce503c..0000000 --- a/auto_email/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/auto_email/urls.py b/auto_email/urls.py deleted file mode 100755 index 419a73d..0000000 --- a/auto_email/urls.py +++ /dev/null @@ -1,13 +0,0 @@ - -from django.urls import path,include -from . import views - - - -urlpatterns = [ - - path('mnfnotification/', views.mnf_notification, name="mnfnotification"), - path('mnfnotification//', views.mnf_notification, name="mnfnotification"), - - -] diff --git a/auto_email/views.py b/auto_email/views.py deleted file mode 100755 index 5268578..0000000 --- a/auto_email/views.py +++ /dev/null @@ -1,270 +0,0 @@ -from .models import * -from .serializer import * -from rest_framework.response import Response -from rest_framework.decorators import (api_view, authentication_classes, - permission_classes) -from rest_framework_simplejwt.authentication import JWTAuthentication -from rest_framework.permissions import AllowAny, IsAuthenticated -from django.core.mail import EmailMultiAlternatives -from django.utils.html import strip_tags -from django.template.loader import render_to_string -from django.conf import settings -from MNF.settings import BasePath -from django.core.mail import send_mail , get_connection -from payment.models import privilegedUser1 -from django.contrib.auth.models import User -from viewerLounge.models import VideoIntroduction -from lpp.models import MNFLPPDDatabase -from harkat.models import HarkatClubDatabase -from mnfapp.models import centralDatabase -import os -from threading import Thread -import pandas as pd -from auto_email.models import emails_creadentials , auto_email_function_errors -from MNF.settings import BasePath -from users.models import UserCredentialsForBlockchain -from ScriptPad2.models import SPProject -from scriptAudit.models import ScriptAuditModel -from ideamall2.models import Premise -from mnfapp.models import ReferUser - - -basepath = BasePath() -def newfunc(list): - for i in list: - t = User.objects.filter(email=i) - if t.exists(): - t = t[0] - username = t.first_name if t.first_name else t.email - return True - -def poster(user,email_code=None): - try: - data = User.objects.filter(email = user).values() - id = data[0]['id'] - if email_code.startswith("MR"): - return '1' - elif email_code.startswith("IM"): - return '2' - elif email_code.startswith("SD"): - return '3' - elif email_code.startswith("SB"): - return '4' - elif email_code.startswith("CP"): - return '5' - # elif email_code.startswith("PP"): - # return '6' - elif email_code.startswith("PP"): - return '7' - elif email_code.startswith("ID"): - return '8' - # elif email_code.startswith("ID"): - # return '9' - elif email_code.startswith("GT"): - return '10' - elif email_code.startswith("RM"): - return '11' - elif email_code.startswith("RN"): - return '12' - elif email_code.startswith("TN"): - return '13' - elif email_code.startswith("BL"): - return '14' - elif email_code.startswith("PM"): - return '15' - elif email_code.startswith("VW"): - return '16' - else : - pass - except Exception as e: - print(e) - auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) - return '20' - -def mailer(all_email,email_code,key_value,filePath): - print('basepath',basepath) - try: - if not key_value: - key_value={} - for to_email in all_email: - try: - try: - name = centralDatabase.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.firstName if name.firstName else name.email - except: - name = User.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.first_name if name.first_name else name.email - except: - userName = to_email - key_value.update({"User":userName}) - sheet_code_excel = f'{basepath}/auto_email/email/sheetCodeExcel.xlsx' - fileexcel = pd.read_excel(sheet_code_excel) - s1 = slice(0, 2) - string = email_code[s1] - value = fileexcel[fileexcel['sheet code'] == string] - if len(value) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code does not match with any sheet ") - return print(('Email code does not match with any sheet')) - sheet_name = value.iloc[0, 1] - file_path = f"{basepath}/auto_email/email/EMAILSheet39.xlsx" - file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) - row_data = file[file['Email Code'] == str(email_code)] - if len(row_data) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code is not present in any sheet") - return print('Email code is not present in any sheet') - row_data = row_data.fillna('') - from_email = row_data.iloc[0, 3] - additional_option_code = row_data.iloc[0, 7] - option_file = pd.read_excel( - file_path, sheet_name='Common Options', header=1) - option_details = option_file[option_file['CODE'] == str( - additional_option_code)] - if len(option_details) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error='options code does not match with sheet options code') - return print('options code does not match with sheet options code') - poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) - poster_code = poster(user=to_email,email_code = email_code) - postercode = 'P'+str(poster_code) - if poster_code == '11': - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="user has not any priority to send poster") - return print('user has not any priority to send poster') - poster_url = poster_file[poster_file['Poster code'] == str(postercode)] - posterurl = poster_url.iloc[0, 2] - page_url = poster_url.iloc[0,3] - doodle_url = poster_url.iloc[0,4] - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) - dic_invitation = str(row_data.iloc[0, 6]).replace('{}','').format_map(key_value) - dic_additional = str(option_details.iloc[0, 2]).replace('{}','').format_map(key_value) - title = str(row_data.iloc[0, 5]).replace('{}','').format_map(key_value).split('/') - print("title", title) - message = {'subject': dic_subject, - 'title1': title[0], - 'title2': title[1], - 'invitation':dic_invitation, - 'additional': dic_additional, - 'poster': posterurl, - 'pageurl':page_url, - 'doodleurl':doodle_url, - 'emailcode':email_code - } - msg_html = render_to_string('email_template.html', message) - excel_file = f"{basepath}/auto_email/email/EmailCredentials.xlsx" - details = pd.read_excel(excel_file) - email_data = details[details['email'] == str(from_email)] - host = email_data.iloc[0, 1] - port = int(email_data.iloc[0, 2]) - password = emails_creadentials.objects.get(email=from_email) - connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) - # send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) - sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,to=[to_email],connection=connection) - sendMail.attach_alternative(msg_html,"text/html") - if filePath is not None: - sendMail.attach_file(f'{filePath}') - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/ideamall.png") - if "Idea Mall" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Idea Mall",image_url = "/static/Notification_image/Idea_Mall.png") - elif "Conversion - LPP" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion - LPP",image_url = "/static/Notification_image/Conversion_LPP.png") - elif "Script Builder" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Builder",image_url = "/static/Notification_image/Script_Builder.png") - elif "Messiah" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Messiah",image_url = "/static/Notification_image/Messiah.png") - elif "Project Centre" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Project Centre",image_url = "/static/Notification_image/Project_Centre.png") - elif "Harkat" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Harkat",image_url = "/static/Notification_image/Harkat.png") - elif "Pitchdeck Bundle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Pitchdeck Bundle",image_url = "/static/Notification_image/Pitchdeck_Bundle.png") - elif "Script page" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Page",image_url = "/static/Notification_image/Script_page.png") - elif "subtitle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Subtitle",image_url = "/static/Notification_image/subtitle.png") - elif "script pad" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "script pad",image_url = "/static/Notification_image/scriptpad.png") - elif "narration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Narration",image_url = "/static/Notification_image/narration.png") - elif "Institutional Membership" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/static/Notification_image/Institutional_Membership.png") - elif "LPP - Admininstration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "LPP - Admininstration",image_url = "/static/Notification_image/LPP_Admininstration.png") - elif "Conversion ppt" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion PPT",image_url = "/static/Notification_image/Conversion_ppt.png") - elif "viewers lounge" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Viewers Lounge",image_url = "/static/Notification_image/viewers_lounge.png") - elif "Ask a question" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Ask a question",image_url = "/static/Notification_image/subtitle.png") - elif "Payment" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Payment",image_url = "/static/Notification_image/payment.png") - elif "blockchain" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "blockchain",image_url = "/static/Notification_image/blockchain.png") - elif "Sheet14" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Sheet14",image_url = "/static/Notification_image/subtitle.png") - elif "Institutional Membership" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/static/Notification_image/subtitle.png") - elif "membershipReferences" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "membershipReferences",image_url = "/static/Notification_image/subtitle.png") - else: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) - print('mnf_not') - mnf_notification.save() - print("sendmail1") - sendMail.send() - - print('done compete notification') - return - except Exception as error: - print(error) - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error=str(error)) - pass - - -def sendmail(to_email,email_code,key_value=None,filePath=None): - t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) - t.start() - return - - - - -@api_view(["GET", "DELETE", "POST", "PUT", "PATCH"]) -@authentication_classes([JWTAuthentication]) -@permission_classes([IsAuthenticated]) -def mnf_notification(request,pk=None): - if request.method == "GET": - if pk is not None: - main = Mnf_Notification.objects.all().filter(user=pk) - if main: - - serializer = Mnf_NotificationSerializer(main,many=True) - return Response(serializer.data) - else: - return Response([]) - - main = Mnf_Notification.objects.all() - serializer = Mnf_NotificationSerializer(main, many=True) - return Response(serializer.data) - if request.method == "PATCH": - main = Mnf_Notification.objects.get(id=pk) - serializer = Mnf_NotificationSerializer(main, data=request.data ,partial=True) - if serializer.is_valid(): - serializer.save() - return Response("partial data updated") - return Response(serializer.errors) - if request.method == "DELETE": - if pk is not None: - main = Mnf_Notification.objects.filter(id=pk) - # else: - # main = MemberProfile.objects.filter(projectid=pk) - main.delete() - return Response("data deleted") \ No newline at end of file diff --git a/auto_email/views.py.save b/auto_email/views.py.save deleted file mode 100755 index e99893d..0000000 --- a/auto_email/views.py.save +++ /dev/null @@ -1,457 +0,0 @@ -# from django.core.mail import EmailMultiAlternatives -# from django.utils.html import strip_tags -# from django.template.loader import render_to_string -# from django.conf import settings -# from MNF.settings import BasePath -# from django.core.mail import send_mail , get_connection -# from payment.models import privilegedUser1 -# from django.contrib.auth.models import User -# from viewerLounge.models import VideoIntroduction, LifeMemberForm -# from lpp.models import MNFLPPDDatabase -# from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -# from mnfapp.models import centralDatabase -# import os -# from threading import Thread -# import time -# import pandas as pd -# from auto_email.models import emails_creadentials , auto_email_function_errors -# from MNF.settings import BasePath -from .models import * -from .serializer import * -#<<<<<<< Updated upstream -from rest_framework.response import Response - -from rest_framework.response import Response -#>>>>>>> Stashed changes -from rest_framework.decorators import (api_view, authentication_classes, - permission_classes) -from rest_framework_simplejwt.authentication import JWTAuthentication -from rest_framework.permissions import AllowAny, IsAuthenticated - -# import time -# Create your views here. - - -# basepath = BasePath() -# def newfunc(list): -# for i in list: -# t = User.objects.filter(email=i) -# if t.exists(): -# t = t[0] -# username = t.first_name if t.first_name else t.email -# return True - -# def poster(user,email_code=None): -# try: -# data = User.objects.filter(email = user).values() -# id = data[0]['id'] -# central_object = centralDatabase.objects.get(user_id=id) -# if not central_object.isWhatsappJoined: -# return '1' -# elif not central_object.isNewsLetterSubscribed: -# return '2' -# elif not VideoIntroduction.objects.filter(user=id).exists(): -# return '3' -# elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): -# return '4' -# elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): -# return '5' -# elif not privilegedUser1.objects.filter(user=id).exists(): -# return '6' -# elif not RMDatabase.objects.filter(user_id=id).exists(): -# return '7' -# elif not central_object.isTelegramJoined: -# return '8' -# # elif not LifeMemberForm.objects.get(user=id).exists(): -# # return '9' -# # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): -# # return '10' -# else: -# return '9' -# except Exception as e: -# print(e) -# auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) -# return '10' - - -# def mailer(all_email,email_code): -# try: -# for to_email in all_email: -# sheet_code_excel = '/home/user/mnf/project/MNF/MNF/email/sheetCodeExcel.xlsx' -# fileexcel = pd.read_excel(sheet_code_excel) -# s1 = slice(0, 2) -# string = email_code[s1] -# value = fileexcel[fileexcel['sheet code'] == string] -# if len(value) <= 0: -# return ('Email code does not match with any sheet ') -# sheet_name = value.iloc[0, 1] -# file_path = "/home/user/mnf/project/MNF/MNF/email/EMAILSheet.xlsx" -# file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) -# row_data = file[file['Email Code'] == str(email_code)] -# if len(row_data) <= 0: -# return 'Email code is not present in any sheet' -# row_data = row_data.fillna('') -# from_email = row_data.iloc[0, 3] -# additional_option_code = row_data.iloc[0, 7] -# option_file = pd.read_excel( -# file_path, sheet_name='Common Options', header=1) -# option_details = option_file[option_file['CODE'] == str( -# additional_option_code)] -# if len(option_details) <= 0: -# return 'options code does not match with sheet options code' -# poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) -# poster_code = poster(user=to_email) -# postercode = 'P'+str(poster_code) -# if poster_code == '12': -# return 'user has not any priority to send poster' -# poster_url = poster_file[poster_file['Poster code'] == str(postercode)] -# posterurl = poster_url.iloc[0, 2] -# title = row_data.iloc[0, 5].split('/') -# message = {'subject': row_data.iloc[0, 4], -# 'title1': title[0], -# 'title2': title[1], -# 'invitation': row_data.iloc[0, 4], -# 'additional': option_details.iloc[0, 2], -# 'poster': posterurl, -# } -# msg_html = render_to_string('email_templete.html', message) -# excel_file = "/home/user/mnf/project/MNF/MNF/email/EmailCredentials.xlsx" -# details = pd.read_excel(excel_file) -# email_data = details[details['email'] == str(from_email)] -# host = email_data.iloc[0, 1] -# port = int(email_data.iloc[0, 2]) -<<<<<<< Updated upstream -# password = emails_creadentials.objects.get(email=from_email) -======= -# password = emails_creadentials.objects.get(email=from_email) ->>>>>>> Stashed changes -# connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) -# send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) -# notification=Mnf_Notification(user=to_email,title=title[1]) -# notifiaction.save() -# return -# except Exception as error: -# pass - -# def sendmail(to_email,email_code,key_value=None,filePath=None): -# # start_time = time.process_time() -# # t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) -# t = Thread(target=mailer,args=(to_email,email_code)) -#<<<<<<< Updated upstream - - - -#>>>>>>> Stashed changes -# t.start() -# # t = mailer(to_email,email_code,key_value) -# # print(t) -# # time.sleep(1) -# # print("email func has taken", time.process_time()-start_time, "time") -#<<<<<<< Updated upstream -# return - -#>>>>>>> Stashed changes - -from django.core.mail import EmailMultiAlternatives -from django.utils.html import strip_tags -from django.template.loader import render_to_string -from django.conf import settings -from MNF.settings import BasePath -from django.core.mail import send_mail , get_connection -from payment.models import privilegedUser1 -from django.contrib.auth.models import User -from viewerLounge.models import VideoIntroduction -from lpp.models import MNFLPPDDatabase -from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -from mnfapp.models import centralDatabase -import os -from threading import Thread -import pandas as pd -from auto_email.models import emails_creadentials , auto_email_function_errors -from MNF.settings import BasePath -# Create your views here. - - -basepath = BasePath() -def newfunc(list): - for i in list: - t = User.objects.filter(email=i) - if t.exists(): - t = t[0] - username = t.first_name if t.first_name else t.email - return True - -def poster(user,email_code=None): - try: - data = User.objects.filter(email = user).values() - id = data[0]['id'] - if not centralDatabase.objects.get(user_id=id).isWhatsappJoined: - return '1' - elif not centralDatabase.objects.get(user_id=id).isNewsLetterSubscribed: - return '2' - elif not VideoIntroduction.objects.filter(user=id).exists(): - return '3' - elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): - return '4' - elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): - return '5' - elif not privilegedUser1.objects.filter(user=id).exists(): - return '6' -<<<<<<< Updated upstream - elif not RMDatabase.objects.filter(user_id=id).exists(): - return '7' -======= - # elif not RMDatabase.objects.filter(user_id=id).exists(): - # return '7' ->>>>>>> Stashed changes - elif not centralDatabase.objects.get(user_id=id).isTelegramJoined: - return '8' - # elif not LifeMemberForm.objects.get(user=id).exists(): - # return '9' - # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): - # return '10' - else: - return '9' - except Exception as e: - print(e) - auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) - return '10' - -def mailer(all_email,email_code,key_value,filePath): - print('basepath',basepath) - try: - if not key_value: - key_value={} - for to_email in all_email: - try: - try: - name = centralDatabase.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.firstName if name.firstName else name.email - except: - name = User.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.first_name if name.first_name else name.email - except: - userName = to_email - key_value.update({"User":userName}) - sheet_code_excel = f'{basepath}/MNF/email/sheetCodeExcel.xlsx' - fileexcel = pd.read_excel(sheet_code_excel) - s1 = slice(0, 2) - string = email_code[s1] - print("string",string) - value = fileexcel[fileexcel['sheet code'] == string] - print("value",value) - if len(value) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code does not match with any sheet ") - return print(('Email code does not match with any sheet')) - sheet_name = value.iloc[0, 1] - print("sheetname",sheet_name) - file_path = f"{basepath}/MNF/email/EMAILSheet39.xlsx" - file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) - row_data = file[file['Email Code'] == str(email_code)] - if len(row_data) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code is not present in any sheet") - return print('Email code is not present in any sheet') - row_data = row_data.fillna('') - from_email = row_data.iloc[0, 3] - print(from_email,"from_email") - additional_option_code = row_data.iloc[0, 7] - option_file = pd.read_excel( - file_path, sheet_name='Common Options', header=1) - option_details = option_file[option_file['CODE'] == str( - additional_option_code)] - if len(option_details) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error='options code does not match with sheet options code') - return print('options code does not match with sheet options code') - poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) - poster_code = poster(user=to_email,email_code = email_code) - postercode = 'P'+str(poster_code) - if poster_code == '11': - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="user has not any priority to send poster") - return print('user has not any priority to send poster') - poster_url = poster_file[poster_file['Poster code'] == str(postercode)] - posterurl = poster_url.iloc[0, 2] - page_url = poster_url.iloc[0,3] -<<<<<<< Updated upstream - - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) -======= - - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) ->>>>>>> Stashed changes - dic_invitation = str(row_data.iloc[0, 6]).replace('{}','').format_map(key_value) - dic_additional = str(option_details.iloc[0, 2]).replace('{}','').format_map(key_value) - title = str(row_data.iloc[0, 5]).replace('{}','').format_map(key_value).split('/') - message = {'subject': dic_subject, - 'title1': title[0], - 'title2': title[1], - 'invitation':dic_invitation, - 'additional': dic_additional, - 'poster': posterurl, - 'pageurl':page_url, - 'emailcode':email_code - } - print('doneeee') -<<<<<<< Updated upstream - msg_html = render_to_string('email_template2.html', message) - excel_file = f"{basepath}/MNF/email/EmailCredentials.xlsx" -======= - msg_html = render_to_string('email_template.html', message) - print('msg_html') - excel_file = f"{basepath}/MNF/email/EmailCredentials.xlsx" - print('exlefile', excel_file) ->>>>>>> Stashed changes - details = pd.read_excel(excel_file) - print('details') - email_data = details[details['email'] == str(from_email)] - print('email_sas') - host = email_data.iloc[0, 1] - print('hosj') - port = int(email_data.iloc[0, 2]) - print('pass1') - password = emails_creadentials.objects.get(email=from_email) - print('pass2') - connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) - print('conn1') - # send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) - sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,to=[to_email],connection=connection) - print('con2') - sendMail.attach_alternative(msg_html,"text/html") - print('texthtml') - if filePath is not None: - sendMail.attach_file(f'{filePath}') -<<<<<<< Updated upstream - - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd -======= - print('notnone') - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd ->>>>>>> Stashed changes - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/ideamall.png") - if "Idea Mall" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Idea Mall",image_url = "/media/Notification_image/Idea_Mall.png") - elif "Conversion - LPP" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion - LPP",image_url = "/media/Notification_image/Conversion_LPP.png") - elif "Script Builder" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Builder",image_url = "/media/Notification_image/Script_Builder.png") - elif "Messiah" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Messiah",image_url = "/media/Notification_image/Messiah.png") - elif "Project Centre" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Project Centre",image_url = "/media/Notification_image/Project_Centre.png") - elif "Harkat" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Harkat",image_url = "/media/Notification_image/Harkat.png") - elif "Pitchdeck Bundle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Pitchdeck Bundle",image_url = "/media/Notification_image/Pitchdeck_Bundle.png") - elif "Script page" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Page",image_url = "/media/Notification_image/Script_page.png") - elif "subtitle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Subtitle",image_url = "/media/Notification_image/subtitle.png") - # elif "script pad": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - elif "narration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Narration",image_url = "/media/Notification_image/narration.png") - elif "Institutional Membership" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/media/Notification_image/Institutional_Membership.png") - elif "LPP - Admininstration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "LPP - Admininstration",image_url = "/media/Notification_image/LPP_Admininstration.png") - elif "Conversion ppt" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion PPT",image_url = "/media/Notification_image/Conversion_ppt.png") - elif "viewers lounge" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Viewers Lounge",image_url = "/media/Notification_image/viewers_lounge.png") - # elif "Ask a question": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Payment": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/payment.png") - # elif sheet_name == "blockchain": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/blockchain.png") - # elif sheet_name == "Sheet14": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - else: -<<<<<<< Updated upstream - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) -======= - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) - print('mnf_not') ->>>>>>> Stashed changes - mnf_notification.save() - print("sendmail1") - sendMail.send() -<<<<<<< Updated upstream - -======= - ->>>>>>> Stashed changes - print('done compete notification') - return - except Exception as error: - print(error) - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error=str(error)) - pass - - -def sendmail(to_email,email_code,key_value=None,filePath=None): - t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) - t.start() - # t = mailer(to_email,email_code,key_value) - # print(t) -<<<<<<< Updated upstream - return -======= - return ->>>>>>> Stashed changes - - - - -@api_view(["GET", "DELETE", "POST", "PUT", "PATCH"]) -@authentication_classes([JWTAuthentication]) -@permission_classes([IsAuthenticated]) -def mnf_notification(request,pk=None): - if request.method == "GET": - if pk is not None: - main = Mnf_Notification.objects.all().filter(user=pk) - if main: - - serializer = Mnf_NotificationSerializer(main,many=True) - return Response(serializer.data) - else: - return Response([]) - - main = Mnf_Notification.objects.all() - serializer = Mnf_NotificationSerializer(main, many=True) - return Response(serializer.data) - if request.method == "PATCH": - main = Mnf_Notification.objects.get(id=pk) - serializer = Mnf_NotificationSerializer(main, data=request.data ,partial=True) - if serializer.is_valid(): - serializer.save() - return Response("partial data updated") - return Response(serializer.errors) - if request.method == "DELETE": - if pk is not None: - main = Mnf_Notification.objects.filter(id=pk) - # else: - # main = MemberProfile.objects.filter(projectid=pk) - main.delete() - return Response("data deleted") diff --git a/auto_email/views.py.save.1 b/auto_email/views.py.save.1 deleted file mode 100755 index ea009fc..0000000 --- a/auto_email/views.py.save.1 +++ /dev/null @@ -1,861 +0,0 @@ -# from django.core.mail import EmailMultiAlternatives -# from django.utils.html import strip_tags -# from django.template.loader import render_to_string -# from django.conf import settings -# from MNF.settings import BasePath -# from django.core.mail import send_mail , get_connection -# from payment.models import privilegedUser1 -# from django.contrib.auth.models import User -# from viewerLounge.models import VideoIntroduction, LifeMemberForm -# from lpp.models import MNFLPPDDatabase -# from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -# from mnfapp.models import centralDatabase -# import os -# from threading import Thread -# import time -# import pandas as pd -# from auto_email.models import emails_creadentials , auto_email_function_errors -# from MNF.settings import BasePath -from .models import * -from .serializer import * -from rest_framework.response import Response -from rest_framework.decorators import (api_view, authentication_classes, - permission_classes) -from rest_framework_simplejwt.authentication import JWTAuthentication -from rest_framework.permissions import AllowAny, IsAuthenticated - -# import time -# Create your views here. - - -# basepath = BasePath() -# def newfunc(list): -# for i in list: -# t = User.objects.filter(email=i) -# if t.exists(): -# t = t[0] -# username = t.first_name if t.first_name else t.email -# return True - -# def poster(user,email_code=None): -# try: -# data = User.objects.filter(email = user).values() -# id = data[0]['id'] -# central_object = centralDatabase.objects.get(user_id=id) -# if not central_object.isWhatsappJoined: -# return '1' -# elif not central_object.isNewsLetterSubscribed: -# return '2' -# elif not VideoIntroduction.objects.filter(user=id).exists(): -# return '3' -# elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): -# return '4' -# elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): -# return '5' -# elif not privilegedUser1.objects.filter(user=id).exists(): -# return '6' -# elif not RMDatabase.objects.filter(user_id=id).exists(): -# return '7' -# elif not central_object.isTelegramJoined: -# return '8' -# # elif not LifeMemberForm.objects.get(user=id).exists(): -# # return '9' -# # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): -# # return '10' -# else: -# return '9' -# except Exception as e: -# print(e) -# auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) -# return '10' - - -# def mailer(all_email,email_code): -# try: -# for to_email in all_email: -# sheet_code_excel = '/home/user/mnf/project/MNF/MNF/email/sheetCodeExcel.xlsx' -# fileexcel = pd.read_excel(sheet_code_excel) -# s1 = slice(0, 2) -# string = email_code[s1] -# value = fileexcel[fileexcel['sheet code'] == string] -# if len(value) <= 0: -# return ('Email code does not match with any sheet ') -# sheet_name = value.iloc[0, 1] -# file_path = "/home/user/mnf/project/MNF/MNF/email/EMAILSheet.xlsx" -# file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) -# row_data = file[file['Email Code'] == str(email_code)] -# if len(row_data) <= 0: -# return 'Email code is not present in any sheet' -# row_data = row_data.fillna('') -# from_email = row_data.iloc[0, 3] -# additional_option_code = row_data.iloc[0, 7] -# option_file = pd.read_excel( -# file_path, sheet_name='Common Options', header=1) -# option_details = option_file[option_file['CODE'] == str( -# additional_option_code)] -# if len(option_details) <= 0: -# return 'options code does not match with sheet options code' -# poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) -# poster_code = poster(user=to_email) -# postercode = 'P'+str(poster_code) -# if poster_code == '12': -# return 'user has not any priority to send poster' -# poster_url = poster_file[poster_file['Poster code'] == str(postercode)] -# posterurl = poster_url.iloc[0, 2] -# title = row_data.iloc[0, 5].split('/') -# message = {'subject': row_data.iloc[0, 4], -# 'title1': title[0], -# 'title2': title[1], -# 'invitation': row_data.iloc[0, 4], -# 'additional': option_details.iloc[0, 2], -# 'poster': posterurl, -# } -# msg_html = render_to_string('email_templete.html', message) -# excel_file = "/home/user/mnf/project/MNF/MNF/email/EmailCredentials.xlsx" -# details = pd.read_excel(excel_file) -# email_data = details[details['email'] == str(from_email)] -# host = email_data.iloc[0, 1] -# port = int(email_data.iloc[0, 2]) -# password = emails_creadentials.objects.get(email=from_email) -# connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) -# send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) -# notification=Mnf_Notification(user=to_email,title=title[1]) -# notifiaction.save() -# return -# except Exception as error: -# pass - -# def sendmail(to_email,email_code,key_value=None,filePath=None): -# # start_time = time.process_time() -# # t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) -# t = Thread(target=mailer,args=(to_email,email_code)) - -# t.start() -# # t = mailer(to_email,email_code,key_value) -# # print(t) -# # time.sleep(1) -# # print("email func has taken", time.process_time()-start_time, "time") -# return - -from django.core.mail import EmailMultiAlternatives -from django.utils.html import strip_tags -from django.template.loader import render_to_string -from django.conf import settings -from MNF.settings import BasePath -from django.core.mail import send_mail , get_connection -from payment.models import privilegedUser1 -from django.contrib.auth.models import User -from viewerLounge.models import VideoIntroduction -from lpp.models import MNFLPPDDatabase -from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -from mnfapp.models import centralDatabase -import os -from threading import Thread -import pandas as pd -from auto_email.models import emails_creadentials , auto_email_function_errors -from MNF.settings import BasePath -# Create your views here. - - -basepath = BasePath() -def newfunc(list): - for i in list: - t = User.objects.filter(email=i) - if t.exists(): - t = t[0] - username = t.first_name if t.first_name else t.email - return True - -def poster(user,email_code=None): - try: - data = User.objects.filter(email = user).values() - id = data[0]['id'] - if not centralDatabase.objects.get(user_id=id).isWhatsappJoined: - return '1' - elif not centralDatabase.objects.get(user_id=id).isNewsLetterSubscribed: - return '2' - elif not VideoIntroduction.objects.filter(user=id).exists(): - return '3' - elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): - return '4' - elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): - return '5' - elif not privilegedUser1.objects.filter(user=id).exists(): - return '6' - # elif not RMDatabase.objects.filter(user_id=id).exists(): - # return '7' - elif not centralDatabase.objects.get(user_id=id).isTelegramJoined: - return '8' - # elif not LifeMemberForm.objects.get(user=id).exists(): - # return '9' - # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): - # return '10' - else: - return '9' - except Exception as e: - print(e) - auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) - return '10' - -def mailer(all_email,email_code,key_value,filePath): - print('basepath',basepath) - try: - if not key_value: - key_value={} - for to_email in all_email: - try: - try: - name = centralDatabase.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.firstName if name.firstName else name.email - except: - name = User.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.first_name if name.first_name else name.email - except: - userName = to_email - key_value.update({"User":userName}) - sheet_code_excel = f'{basepath}/MNF/email/sheetCodeExcel.xlsx' - fileexcel = pd.read_excel(sheet_code_excel) - s1 = slice(0, 2) - string = email_code[s1] - print("string",string) - value = fileexcel[fileexcel['sheet code'] == string] - print("value",value) - if len(value) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code does not match with any sheet ") - return print(('Email code does not match with any sheet')) - sheet_name = value.iloc[0, 1] - print("sheetname",sheet_name) - file_path = f"{basepath}/MNF/email/EMAILSheet39.xlsx" - file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) - row_data = file[file['Email Code'] == str(email_code)] - if len(row_data) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code is not present in any sheet") - return print('Email code is not present in any sheet') - row_data = row_data.fillna('') - from_email = row_data.iloc[0, 3] - print(from_email,"from_email") - additional_option_code = row_data.iloc[0, 7] - option_file = pd.read_excel( - file_path, sheet_name='Common Options', header=1) - option_details = option_file[option_file['CODE'] == str( - additional_option_code)] - if len(option_details) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error='options code does not match with sheet options code') - return print('options code does not match with sheet options code') - poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) - poster_code = poster(user=to_email,email_code = email_code) - postercode = 'P'+str(poster_code) - if poster_code == '11': - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="user has not any priority to send poster") - return print('user has not any priority to send poster') - poster_url = poster_file[poster_file['Poster code'] == str(postercode)] - posterurl = poster_url.iloc[0, 2] - page_url = poster_url.iloc[0,3] - - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) - dic_invitation = str(row_data.iloc[0, 6]).replace('{}','').format_map(key_value) - dic_additional = str(option_details.iloc[0, 2]).replace('{}','').format_map(key_value) - title = str(row_data.iloc[0, 5]).replace('{}','').format_map(key_value).split('/') - message = {'subject': dic_subject, - 'title1': title[0], - 'title2': title[1], - 'invitation':dic_invitation, - 'additional': dic_additional, - 'poster': posterurl, - 'pageurl':page_url, - 'emailcode':email_code - } - print('doneeee') - msg_html = render_to_string('email_template.html', message) - print('msg_html') - excel_file = f"{basepath}/MNF/email/EmailCredentials.xlsx" - print('exlefile', excel_file) - details = pd.read_excel(excel_file) - print('details') - email_data = details[details['email'] == str(from_email)] - print('email_sas') - host = email_data.iloc[0, 1] - print('hosj') - port = int(email_data.iloc[0, 2]) - print('pass1') - password = emails_creadentials.objects.get(email=from_email) - print('pass2') - connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) - print('conn1') - # send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) - sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,to=[to_email],connection=connection) - print('con2') - sendMail.attach_alternative(msg_html,"text/html") - print('texthtml') - if filePath is not None: - sendMail.attach_file(f'{filePath}') - print('notnone') - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/ideamall.png") - if "Idea Mall" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Idea Mall",image_url = "/media/Notification_image/Idea_Mall.png") - elif "Conversion - LPP" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion - LPP",image_url = "/media/Notification_image/Conversion_LPP.png") - elif "Script Builder" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Builder",image_url = "/media/Notification_image/Script_Builder.png") - elif "Messiah" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Messiah",image_url = "/media/Notification_image/Messiah.png") - elif "Project Centre" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Project Centre",image_url = "/media/Notification_image/Project_Centre.png") - elif "Harkat" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Harkat",image_url = "/media/Notification_image/Harkat.png") - elif "Pitchdeck Bundle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Pitchdeck Bundle",image_url = "/media/Notification_image/Pitchdeck_Bundle.png") - elif "Script page" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Page",image_url = "/media/Notification_image/Script_page.png") - elif "subtitle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Subtitle",image_url = "/media/Notification_image/subtitle.png") - # elif "script pad": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - elif "narration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Narration",image_url = "/media/Notification_image/narration.png") - elif "Institutional Membership" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/media/Notification_image/Institutional_Membership.png") - elif "LPP - Admininstration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "LPP - Admininstration",image_url = "/media/Notification_image/LPP_Admininstration.png") - elif "Conversion ppt" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion PPT",image_url = "/media/Notification_image/Conversion_ppt.png") - elif "viewers lounge" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Viewers Lounge",image_url = "/media/Notification_image/viewers_lounge.png") - # elif "Ask a question": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Payment": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/payment.png") - # elif sheet_name == "blockchain": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/blockchain.png") - # elif sheet_name == "Sheet14": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - else: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) - print('mnf_not') - mnf_notification.save() - print("sendmail1") - sendMail.send() - - print('done compete notification') - return - except Exception as error: - print(error) - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error=str(error)) - pass - - -def sendmail(to_email,email_code,key_value=None,filePath=None): - t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) - t.start() - # t = mailer(to_email,email_code,key_value) - # print(t) - return - - - - -@api_view(["GET", "DELETE", "POST", "PUT", "PATCH"]) -@authentication_classes([JWTAuthentication]) -@permission_classes([IsAuthenticated]) -def mnf_notification(request,pk=None): - if request.method == "GET": - if pk is not None: - main = Mnf_Notification.objects.all().filter(user=pk) - if main: - - serializer = Mnf_NotificationSerializer(main,many=True) - return Response(serializer.data) - else: - return Response([]) - - main = Mnf_Notification.objects.all() - serializer = Mnf_NotificationSerializer(main, many=True) - return Response(serializer.data) - if request.method == "PATCH": - main = Mnf_Notification.objects.get(id=pk) - serializer = Mnf_NotificationSerializer(main, data=request.data ,partial=True) - if serializer.is_valid(): - serializer.save() - return Response("partial data updated") - return Response(serializer.errors) - if request.method == "DELETE": - if pk is not None: - main = Mnf_Notification.objects.filter(id=pk) - # else: - # main = MemberProfile.objects.filter(projectid=pk) - main.delete() - return Response("data deleted")# from django.core.mail import EmailMultiAlternatives -# from django.utils.html import strip_tags -# from django.template.loader import render_to_string -# from django.conf import settings -# from MNF.settings import BasePath -# from django.core.mail import send_mail , get_connection -# from payment.models import privilegedUser1 -# from django.contrib.auth.models import User -# from viewerLounge.models import VideoIntroduction, LifeMemberForm -# from lpp.models import MNFLPPDDatabase -# from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -# from mnfapp.models import centralDatabase -# import os -# from threading import Thread -# import time -# import pandas as pd -# from auto_email.models import emails_creadentials , auto_email_function_errors -# from MNF.settings import BasePath -from .models import * -from .serializer import * -#<<<<<<< Updated upstream -from rest_framework.response import Response - -from rest_framework.response import Response -#>>>>>>> Stashed changes -from rest_framework.decorators import (api_view, authentication_classes, - permission_classes) -from rest_framework_simplejwt.authentication import JWTAuthentication -from rest_framework.permissions import AllowAny, IsAuthenticated - -# import time -# Create your views here. - - -# basepath = BasePath() -# def newfunc(list): -# for i in list: -# t = User.objects.filter(email=i) -# if t.exists(): -# t = t[0] -# username = t.first_name if t.first_name else t.email -# return True - -# def poster(user,email_code=None): -# try: -# data = User.objects.filter(email = user).values() -# id = data[0]['id'] -# central_object = centralDatabase.objects.get(user_id=id) -# if not central_object.isWhatsappJoined: -# return '1' -# elif not central_object.isNewsLetterSubscribed: -# return '2' -# elif not VideoIntroduction.objects.filter(user=id).exists(): -# return '3' -# elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): -# return '4' -# elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): -# return '5' -# elif not privilegedUser1.objects.filter(user=id).exists(): -# return '6' -# elif not RMDatabase.objects.filter(user_id=id).exists(): -# return '7' -# elif not central_object.isTelegramJoined: -# return '8' -# # elif not LifeMemberForm.objects.get(user=id).exists(): -# # return '9' -# # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): -# # return '10' -# else: -# return '9' -# except Exception as e: -# print(e) -# auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) -# return '10' - - -# def mailer(all_email,email_code): -# try: -# for to_email in all_email: -# sheet_code_excel = '/home/user/mnf/project/MNF/MNF/email/sheetCodeExcel.xlsx' -# fileexcel = pd.read_excel(sheet_code_excel) -# s1 = slice(0, 2) -# string = email_code[s1] -# value = fileexcel[fileexcel['sheet code'] == string] -# if len(value) <= 0: -# return ('Email code does not match with any sheet ') -# sheet_name = value.iloc[0, 1] -# file_path = "/home/user/mnf/project/MNF/MNF/email/EMAILSheet.xlsx" -# file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) -# row_data = file[file['Email Code'] == str(email_code)] -# if len(row_data) <= 0: -# return 'Email code is not present in any sheet' -# row_data = row_data.fillna('') -# from_email = row_data.iloc[0, 3] -# additional_option_code = row_data.iloc[0, 7] -# option_file = pd.read_excel( -# file_path, sheet_name='Common Options', header=1) -# option_details = option_file[option_file['CODE'] == str( -# additional_option_code)] -# if len(option_details) <= 0: -# return 'options code does not match with sheet options code' -# poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) -# poster_code = poster(user=to_email) -# postercode = 'P'+str(poster_code) -# if poster_code == '12': -# return 'user has not any priority to send poster' -# poster_url = poster_file[poster_file['Poster code'] == str(postercode)] -# posterurl = poster_url.iloc[0, 2] -# title = row_data.iloc[0, 5].split('/') -# message = {'subject': row_data.iloc[0, 4], -# 'title1': title[0], -# 'title2': title[1], -# 'invitation': row_data.iloc[0, 4], -# 'additional': option_details.iloc[0, 2], -# 'poster': posterurl, -# } -# msg_html = render_to_string('email_templete.html', message) -# excel_file = "/home/user/mnf/project/MNF/MNF/email/EmailCredentials.xlsx" -# details = pd.read_excel(excel_file) -# email_data = details[details['email'] == str(from_email)] -# host = email_data.iloc[0, 1] -# port = int(email_data.iloc[0, 2]) -<<<<<<< Updated upstream -# password = emails_creadentials.objects.get(email=from_email) -======= -# password = emails_creadentials.objects.get(email=from_email) ->>>>>>> Stashed changes -# connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) -# send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) -# notification=Mnf_Notification(user=to_email,title=title[1]) -# notifiaction.save() -# return -# except Exception as error: -# pass - -# def sendmail(to_email,email_code,key_value=None,filePath=None): -# # start_time = time.process_time() -# # t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) -# t = Thread(target=mailer,args=(to_email,email_code)) -<<<<<<< Updated upstream - -======= - ->>>>>>> Stashed changes -# t.start() -# # t = mailer(to_email,email_code,key_value) -# # print(t) -# # time.sleep(1) -# # print("email func has taken", time.process_time()-start_time, "time") -<<<<<<< Updated upstream -# return -======= -# return ->>>>>>> Stashed changes - -from django.core.mail import EmailMultiAlternatives -from django.utils.html import strip_tags -from django.template.loader import render_to_string -from django.conf import settings -from MNF.settings import BasePath -from django.core.mail import send_mail , get_connection -from payment.models import privilegedUser1 -from django.contrib.auth.models import User -from viewerLounge.models import VideoIntroduction -from lpp.models import MNFLPPDDatabase -from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -from mnfapp.models import centralDatabase -import os -from threading import Thread -import pandas as pd -from auto_email.models import emails_creadentials , auto_email_function_errors -from MNF.settings import BasePath -# Create your views here. - - -basepath = BasePath() -def newfunc(list): - for i in list: - t = User.objects.filter(email=i) - if t.exists(): - t = t[0] - username = t.first_name if t.first_name else t.email - return True - -def poster(user,email_code=None): - try: - data = User.objects.filter(email = user).values() - id = data[0]['id'] - if not centralDatabase.objects.get(user_id=id).isWhatsappJoined: - return '1' - elif not centralDatabase.objects.get(user_id=id).isNewsLetterSubscribed: - return '2' - elif not VideoIntroduction.objects.filter(user=id).exists(): - return '3' - elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): - return '4' - elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): - return '5' - elif not privilegedUser1.objects.filter(user=id).exists(): - return '6' -<<<<<<< Updated upstream - elif not RMDatabase.objects.filter(user_id=id).exists(): - return '7' -======= - # elif not RMDatabase.objects.filter(user_id=id).exists(): - # return '7' ->>>>>>> Stashed changes - elif not centralDatabase.objects.get(user_id=id).isTelegramJoined: - return '8' - # elif not LifeMemberForm.objects.get(user=id).exists(): - # return '9' - # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): - # return '10' - else: - return '9' - except Exception as e: - print(e) - auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) - return '10' - -def mailer(all_email,email_code,key_value,filePath): - print('basepath',basepath) - try: - if not key_value: - key_value={} - for to_email in all_email: - try: - try: - name = centralDatabase.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.firstName if name.firstName else name.email - except: - name = User.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.first_name if name.first_name else name.email - except: - userName = to_email - key_value.update({"User":userName}) - sheet_code_excel = f'{basepath}/MNF/email/sheetCodeExcel.xlsx' - fileexcel = pd.read_excel(sheet_code_excel) - s1 = slice(0, 2) - string = email_code[s1] - print("string",string) - value = fileexcel[fileexcel['sheet code'] == string] - print("value",value) - if len(value) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code does not match with any sheet ") - return print(('Email code does not match with any sheet')) - sheet_name = value.iloc[0, 1] - print("sheetname",sheet_name) - file_path = f"{basepath}/MNF/email/EMAILSheet39.xlsx" - file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) - row_data = file[file['Email Code'] == str(email_code)] - if len(row_data) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code is not present in any sheet") - return print('Email code is not present in any sheet') - row_data = row_data.fillna('') - from_email = row_data.iloc[0, 3] - print(from_email,"from_email") - additional_option_code = row_data.iloc[0, 7] - option_file = pd.read_excel( - file_path, sheet_name='Common Options', header=1) - option_details = option_file[option_file['CODE'] == str( - additional_option_code)] - if len(option_details) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error='options code does not match with sheet options code') - return print('options code does not match with sheet options code') - poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) - poster_code = poster(user=to_email,email_code = email_code) - postercode = 'P'+str(poster_code) - if poster_code == '11': - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="user has not any priority to send poster") - return print('user has not any priority to send poster') - poster_url = poster_file[poster_file['Poster code'] == str(postercode)] - posterurl = poster_url.iloc[0, 2] - page_url = poster_url.iloc[0,3] -<<<<<<< Updated upstream - - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) -======= - - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) ->>>>>>> Stashed changes - dic_invitation = str(row_data.iloc[0, 6]).replace('{}','').format_map(key_value) - dic_additional = str(option_details.iloc[0, 2]).replace('{}','').format_map(key_value) - title = str(row_data.iloc[0, 5]).replace('{}','').format_map(key_value).split('/') - message = {'subject': dic_subject, - 'title1': title[0], - 'title2': title[1], - 'invitation':dic_invitation, - 'additional': dic_additional, - 'poster': posterurl, - 'pageurl':page_url, - 'emailcode':email_code - } - print('doneeee') -<<<<<<< Updated upstream - msg_html = render_to_string('email_template2.html', message) - excel_file = f"{basepath}/MNF/email/EmailCredentials.xlsx" -======= - msg_html = render_to_string('email_template.html', message) - print('msg_html') - excel_file = f"{basepath}/MNF/email/EmailCredentials.xlsx" - print('exlefile', excel_file) ->>>>>>> Stashed changes - details = pd.read_excel(excel_file) - print('details') - email_data = details[details['email'] == str(from_email)] - print('email_sas') - host = email_data.iloc[0, 1] - print('hosj') - port = int(email_data.iloc[0, 2]) - print('pass1') - password = emails_creadentials.objects.get(email=from_email) - print('pass2') - connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) - print('conn1') - # send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) - sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,to=[to_email],connection=connection) - print('con2') - sendMail.attach_alternative(msg_html,"text/html") - print('texthtml') - if filePath is not None: - sendMail.attach_file(f'{filePath}') -<<<<<<< Updated upstream - - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd -======= - print('notnone') - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd ->>>>>>> Stashed changes - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/ideamall.png") - if "Idea Mall" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Idea Mall",image_url = "/media/Notification_image/Idea_Mall.png") - elif "Conversion - LPP" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion - LPP",image_url = "/media/Notification_image/Conversion_LPP.png") - elif "Script Builder" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Builder",image_url = "/media/Notification_image/Script_Builder.png") - elif "Messiah" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Messiah",image_url = "/media/Notification_image/Messiah.png") - elif "Project Centre" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Project Centre",image_url = "/media/Notification_image/Project_Centre.png") - elif "Harkat" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Harkat",image_url = "/media/Notification_image/Harkat.png") - elif "Pitchdeck Bundle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Pitchdeck Bundle",image_url = "/media/Notification_image/Pitchdeck_Bundle.png") - elif "Script page" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Page",image_url = "/media/Notification_image/Script_page.png") - elif "subtitle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Subtitle",image_url = "/media/Notification_image/subtitle.png") - # elif "script pad": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - elif "narration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Narration",image_url = "/media/Notification_image/narration.png") - elif "Institutional Membership" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/media/Notification_image/Institutional_Membership.png") - elif "LPP - Admininstration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "LPP - Admininstration",image_url = "/media/Notification_image/LPP_Admininstration.png") - elif "Conversion ppt" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion PPT",image_url = "/media/Notification_image/Conversion_ppt.png") - elif "viewers lounge" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Viewers Lounge",image_url = "/media/Notification_image/viewers_lounge.png") - # elif "Ask a question": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Payment": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/payment.png") - # elif sheet_name == "blockchain": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/blockchain.png") - # elif sheet_name == "Sheet14": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - else: -<<<<<<< Updated upstream - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) -======= - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) - print('mnf_not') ->>>>>>> Stashed changes - mnf_notification.save() - print("sendmail1") - sendMail.send() -<<<<<<< Updated upstream - -======= - ->>>>>>> Stashed changes - print('done compete notification') - return - except Exception as error: - print(error) - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error=str(error)) - pass - - -def sendmail(to_email,email_code,key_value=None,filePath=None): - t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) - t.start() - # t = mailer(to_email,email_code,key_value) - # print(t) -<<<<<<< Updated upstream - return -======= - return ->>>>>>> Stashed changes - - - - -@api_view(["GET", "DELETE", "POST", "PUT", "PATCH"]) -@authentication_classes([JWTAuthentication]) -@permission_classes([IsAuthenticated]) -def mnf_notification(request,pk=None): - if request.method == "GET": - if pk is not None: - main = Mnf_Notification.objects.all().filter(user=pk) - if main: - - serializer = Mnf_NotificationSerializer(main,many=True) - return Response(serializer.data) - else: - return Response([]) - - main = Mnf_Notification.objects.all() - serializer = Mnf_NotificationSerializer(main, many=True) - return Response(serializer.data) - if request.method == "PATCH": - main = Mnf_Notification.objects.get(id=pk) - serializer = Mnf_NotificationSerializer(main, data=request.data ,partial=True) - if serializer.is_valid(): - serializer.save() - return Response("partial data updated") - return Response(serializer.errors) - if request.method == "DELETE": - if pk is not None: - main = Mnf_Notification.objects.filter(id=pk) - # else: - # main = MemberProfile.objects.filter(projectid=pk) - main.delete() - return Response("data deleted") diff --git a/auto_email/views_old.py b/auto_email/views_old.py deleted file mode 100755 index 251c748..0000000 --- a/auto_email/views_old.py +++ /dev/null @@ -1,458 +0,0 @@ -# from django.core.mail import EmailMultiAlternatives -# from django.utils.html import strip_tags -# from django.template.loader import render_to_string -# from django.conf import settings -# from MNF.settings import BasePath -# from django.core.mail import send_mail , get_connection -# from payment.models import privilegedUser1 -# from django.contrib.auth.models import User -# from viewerLounge.models import VideoIntroduction, LifeMemberForm -# from lpp.models import MNFLPPDDatabase -# from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -# from mnfapp.models import centralDatabase -# import os -# from threading import Thread -# import time -# import pandas as pd -# from auto_email.models import emails_creadentials , auto_email_function_errors -# from MNF.settings import BasePath -from .models import * -from .serializer import * -#<<<<<<< Updated upstream -from rest_framework.response import Response - -from rest_framework.response import Response -#>>>>>>> Stashed changes -from rest_framework.decorators import (api_view, authentication_classes, - permission_classes) -from rest_framework_simplejwt.authentication import JWTAuthentication -from rest_framework.permissions import AllowAny, IsAuthenticated - -# import time -# Create your views here. - - -# basepath = BasePath() -# def newfunc(list): -# for i in list: -# t = User.objects.filter(email=i) -# if t.exists(): -# t = t[0] -# username = t.first_name if t.first_name else t.email -# return True - -# def poster(user,email_code=None): -# try: -# data = User.objects.filter(email = user).values() -# id = data[0]['id'] -# central_object = centralDatabase.objects.get(user_id=id) -# if not central_object.isWhatsappJoined: -# return '1' -# elif not central_object.isNewsLetterSubscribed: -# return '2' -# elif not VideoIntroduction.objects.filter(user=id).exists(): -# return '3' -# elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): -# return '4' -# elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): -# return '5' -# elif not privilegedUser1.objects.filter(user=id).exists(): -# return '6' -# elif not RMDatabase.objects.filter(user_id=id).exists(): -# return '7' -# elif not central_object.isTelegramJoined: -# return '8' -# # elif not LifeMemberForm.objects.get(user=id).exists(): -# # return '9' -# # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): -# # return '10' -# else: -# return '9' -# except Exception as e: -# print(e) -# auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) -# return '10' - - -# def mailer(all_email,email_code): -# try: -# for to_email in all_email: -# sheet_code_excel = '/home/user/mnf/project/MNF/MNF/email/sheetCodeExcel.xlsx' -# fileexcel = pd.read_excel(sheet_code_excel) -# s1 = slice(0, 2) -# string = email_code[s1] -# value = fileexcel[fileexcel['sheet code'] == string] -# if len(value) <= 0: -# return ('Email code does not match with any sheet ') -# sheet_name = value.iloc[0, 1] -# file_path = "/home/user/mnf/project/MNF/MNF/email/EMAILSheet.xlsx" -# file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) -# row_data = file[file['Email Code'] == str(email_code)] -# if len(row_data) <= 0: -# return 'Email code is not present in any sheet' -# row_data = row_data.fillna('') -# from_email = row_data.iloc[0, 3] -# additional_option_code = row_data.iloc[0, 7] -# option_file = pd.read_excel( -# file_path, sheet_name='Common Options', header=1) -# option_details = option_file[option_file['CODE'] == str( -# additional_option_code)] -# if len(option_details) <= 0: -# return 'options code does not match with sheet options code' -# poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) -# poster_code = poster(user=to_email) -# postercode = 'P'+str(poster_code) -# if poster_code == '12': -# return 'user has not any priority to send poster' -# poster_url = poster_file[poster_file['Poster code'] == str(postercode)] -# posterurl = poster_url.iloc[0, 2] -# title = row_data.iloc[0, 5].split('/') -# message = {'subject': row_data.iloc[0, 4], -# 'title1': title[0], -# 'title2': title[1], -# 'invitation': row_data.iloc[0, 4], -# 'additional': option_details.iloc[0, 2], -# 'poster': posterurl, -# } -# msg_html = render_to_string('email_templete.html', message) -# excel_file = "/home/user/mnf/project/MNF/MNF/email/EmailCredentials.xlsx" -# details = pd.read_excel(excel_file) -# email_data = details[details['email'] == str(from_email)] -# host = email_data.iloc[0, 1] -# port = int(email_data.iloc[0, 2]) -<<<<<<< Updated upstream -# password = emails_creadentials.objects.get(email=from_email) -======= -# password = emails_creadentials.objects.get(email=from_email) ->>>>>>> Stashed changes -# connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) -# send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) -# notification=Mnf_Notification(user=to_email,title=title[1]) -# notifiaction.save() -# return -# except Exception as error: -# pass - -# def sendmail(to_email,email_code,key_value=None,filePath=None): -# # start_time = time.process_time() -# # t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) -# t = Thread(target=mailer,args=(to_email,email_code)) -<<<<<<< Updated upstream - -======= - ->>>>>>> Stashed changes -# t.start() -# # t = mailer(to_email,email_code,key_value) -# # print(t) -# # time.sleep(1) -# # print("email func has taken", time.process_time()-start_time, "time") -<<<<<<< Updated upstream -# return -======= -# return ->>>>>>> Stashed changes - -from django.core.mail import EmailMultiAlternatives -from django.utils.html import strip_tags -from django.template.loader import render_to_string -from django.conf import settings -from MNF.settings import BasePath -from django.core.mail import send_mail , get_connection -from payment.models import privilegedUser1 -from django.contrib.auth.models import User -from viewerLounge.models import VideoIntroduction -from lpp.models import MNFLPPDDatabase -from harkat.models import HarkatClubDatabase -# from relationshipmanager.models import RMDatabase -from mnfapp.models import centralDatabase -import os -from threading import Thread -import pandas as pd -from auto_email.models import emails_creadentials , auto_email_function_errors -from MNF.settings import BasePath -# Create your views here. - - -basepath = BasePath() -def newfunc(list): - for i in list: - t = User.objects.filter(email=i) - if t.exists(): - t = t[0] - username = t.first_name if t.first_name else t.email - return True - -def poster(user,email_code=None): - try: - data = User.objects.filter(email = user).values() - id = data[0]['id'] - if not centralDatabase.objects.get(user_id=id).isWhatsappJoined: - return '1' - elif not centralDatabase.objects.get(user_id=id).isNewsLetterSubscribed: - return '2' - elif not VideoIntroduction.objects.filter(user=id).exists(): - return '3' - elif not MNFLPPDDatabase.objects.filter(user_id=id).exists(): - return '4' - elif not HarkatClubDatabase.objects.filter(user_id=id).exists(): - return '5' - elif not privilegedUser1.objects.filter(user=id).exists(): - return '6' -<<<<<<< Updated upstream - elif not RMDatabase.objects.filter(user_id=id).exists(): - return '7' -======= - # elif not RMDatabase.objects.filter(user_id=id).exists(): - # return '7' ->>>>>>> Stashed changes - elif not centralDatabase.objects.get(user_id=id).isTelegramJoined: - return '8' - # elif not LifeMemberForm.objects.get(user=id).exists(): - # return '9' - # elif LifeMemberForm.objects.filter(user=id, showreel__isnull=True).exists(): - # return '10' - else: - return '9' - except Exception as e: - print(e) - auto_email_function_errors.objects.create(email = str(user),email_code=email_code,key_value={"test":"test"},error=str(e)) - return '10' - -def mailer(all_email,email_code,key_value,filePath): - print('basepath',basepath) - try: - if not key_value: - key_value={} - for to_email in all_email: - try: - try: - name = centralDatabase.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.firstName if name.firstName else name.email - except: - name = User.objects.filter(email = to_email) - if name.exists(): - name = name[0] - userName = name.first_name if name.first_name else name.email - except: - userName = to_email - key_value.update({"User":userName}) - sheet_code_excel = f'{basepath}/MNF/email/sheetCodeExcel.xlsx' - fileexcel = pd.read_excel(sheet_code_excel) - s1 = slice(0, 2) - string = email_code[s1] - print("string",string) - value = fileexcel[fileexcel['sheet code'] == string] - print("value",value) - if len(value) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code does not match with any sheet ") - return print(('Email code does not match with any sheet')) - sheet_name = value.iloc[0, 1] - print("sheetname",sheet_name) - file_path = f"{basepath}/MNF/email/EMAILSheet39.xlsx" - file = pd.read_excel(file_path, sheet_name=sheet_name, header=1) - row_data = file[file['Email Code'] == str(email_code)] - if len(row_data) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code is not present in any sheet") - return print('Email code is not present in any sheet') - row_data = row_data.fillna('') - from_email = row_data.iloc[0, 3] - print(from_email,"from_email") - additional_option_code = row_data.iloc[0, 7] - option_file = pd.read_excel( - file_path, sheet_name='Common Options', header=1) - option_details = option_file[option_file['CODE'] == str( - additional_option_code)] - if len(option_details) <= 0: - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error='options code does not match with sheet options code') - return print('options code does not match with sheet options code') - poster_file = pd.read_excel(file_path, sheet_name='poster', header=1) - poster_code = poster(user=to_email,email_code = email_code) - postercode = 'P'+str(poster_code) - if poster_code == '11': - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="user has not any priority to send poster") - return print('user has not any priority to send poster') - poster_url = poster_file[poster_file['Poster code'] == str(postercode)] - posterurl = poster_url.iloc[0, 2] - page_url = poster_url.iloc[0,3] -<<<<<<< Updated upstream - - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) -======= - - dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value) ->>>>>>> Stashed changes - dic_invitation = str(row_data.iloc[0, 6]).replace('{}','').format_map(key_value) - dic_additional = str(option_details.iloc[0, 2]).replace('{}','').format_map(key_value) - title = str(row_data.iloc[0, 5]).replace('{}','').format_map(key_value).split('/') - message = {'subject': dic_subject, - 'title1': title[0], - 'title2': title[1], - 'invitation':dic_invitation, - 'additional': dic_additional, - 'poster': posterurl, - 'pageurl':page_url, - 'emailcode':email_code - } - print('doneeee') -<<<<<<< Updated upstream - msg_html = render_to_string('email_template2.html', message) - excel_file = f"{basepath}/MNF/email/EmailCredentials.xlsx" -======= - msg_html = render_to_string('email_template.html', message) - print('msg_html') - excel_file = f"{basepath}/MNF/email/EmailCredentials.xlsx" - print('exlefile', excel_file) ->>>>>>> Stashed changes - details = pd.read_excel(excel_file) - print('details') - email_data = details[details['email'] == str(from_email)] - print('email_sas') - host = email_data.iloc[0, 1] - print('hosj') - port = int(email_data.iloc[0, 2]) - print('pass1') - password = emails_creadentials.objects.get(email=from_email) - print('pass2') - connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) - print('conn1') - # send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) - sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,to=[to_email],connection=connection) - print('con2') - sendMail.attach_alternative(msg_html,"text/html") - print('texthtml') - if filePath is not None: - sendMail.attach_file(f'{filePath}') -<<<<<<< Updated upstream - - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd -======= - print('notnone') - # if sheet_name == "Rendz (traction)": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png") - # elif sheet_name == "membershipReferences": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png") - # elif sheet_name == "Misc.":cd ->>>>>>> Stashed changes - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/ideamall.png") - if "Idea Mall" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Idea Mall",image_url = "/media/Notification_image/Idea_Mall.png") - elif "Conversion - LPP" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion - LPP",image_url = "/media/Notification_image/Conversion_LPP.png") - elif "Script Builder" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Builder",image_url = "/media/Notification_image/Script_Builder.png") - elif "Messiah" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Messiah",image_url = "/media/Notification_image/Messiah.png") - elif "Project Centre" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Project Centre",image_url = "/media/Notification_image/Project_Centre.png") - elif "Harkat" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Harkat",image_url = "/media/Notification_image/Harkat.png") - elif "Pitchdeck Bundle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Pitchdeck Bundle",image_url = "/media/Notification_image/Pitchdeck_Bundle.png") - elif "Script page" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Page",image_url = "/media/Notification_image/Script_page.png") - elif "subtitle" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Subtitle",image_url = "/media/Notification_image/subtitle.png") - # elif "script pad": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - elif "narration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Narration",image_url = "/media/Notification_image/narration.png") - elif "Institutional Membership" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/media/Notification_image/Institutional_Membership.png") - elif "LPP - Admininstration" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "LPP - Admininstration",image_url = "/media/Notification_image/LPP_Admininstration.png") - elif "Conversion ppt" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion PPT",image_url = "/media/Notification_image/Conversion_ppt.png") - elif "viewers lounge" in sheet_name: - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Viewers Lounge",image_url = "/media/Notification_image/viewers_lounge.png") - # elif "Ask a question": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Payment": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/payment.png") - # elif sheet_name == "blockchain": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/blockchain.png") - # elif sheet_name == "Sheet14": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - # elif sheet_name == "Institutional Membership": - # notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/subtitle.png") - else: -<<<<<<< Updated upstream - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) -======= - mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name) - # from plyer import notification - # notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name ) - print('mnf_not') ->>>>>>> Stashed changes - mnf_notification.save() - print("sendmail1") - sendMail.send() -<<<<<<< Updated upstream - -======= - ->>>>>>> Stashed changes - print('done compete notification') - return - except Exception as error: - print(error) - auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error=str(error)) - pass - - -def sendmail(to_email,email_code,key_value=None,filePath=None): - t = Thread(target=mailer,args=(to_email,email_code,key_value,filePath)) - t.start() - # t = mailer(to_email,email_code,key_value) - # print(t) -<<<<<<< Updated upstream - return -======= - return ->>>>>>> Stashed changes - - - - -@api_view(["GET", "DELETE", "POST", "PUT", "PATCH"]) -@authentication_classes([JWTAuthentication]) -@permission_classes([IsAuthenticated]) -def mnf_notification(request,pk=None): - if request.method == "GET": - if pk is not None: - main = Mnf_Notification.objects.all().filter(user=pk) - if main: - - serializer = Mnf_NotificationSerializer(main,many=True) - return Response(serializer.data) - else: - return Response([]) - - main = Mnf_Notification.objects.all() - serializer = Mnf_NotificationSerializer(main, many=True) - return Response(serializer.data) - if request.method == "PATCH": - main = Mnf_Notification.objects.get(id=pk) - serializer = Mnf_NotificationSerializer(main, data=request.data ,partial=True) - if serializer.is_valid(): - serializer.save() - return Response("partial data updated") - return Response(serializer.errors) - if request.method == "DELETE": - if pk is not None: - main = Mnf_Notification.objects.filter(id=pk) - # else: - # main = MemberProfile.objects.filter(projectid=pk) - main.delete() - return Response("data deleted") diff --git a/kitchen_counter/Blockchain2/Conversion.py b/kitchen_counter/Blockchain2/Conversion.py index 4097f3c..98bad1a 100755 --- a/kitchen_counter/Blockchain2/Conversion.py +++ b/kitchen_counter/Blockchain2/Conversion.py @@ -25,17 +25,15 @@ def UploadConversionData(privatekey,pubkey, user_id,project,data): print("private Key",privatekey) acc1 = web3.eth.account.from_key(privatekey).address nonce = web3.eth.get_transaction_count(acc1) - gas_price = web3.eth.gas_price uploadData = contractInst.functions.UploadConversionData(pubkey,user_id,project,data).build_transaction({ 'gasPrice': web3.eth.gas_price, 'chainId': CHAIN_ID, 'from': acc1, 'nonce': nonce}) signed_transaction = web3.eth.account.sign_transaction(uploadData, private_key=privatekey) transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) print("transaction hash",transaction_hash) transaction_receipt = web3.eth.wait_for_transaction_receipt(transaction_hash) - gas_used = transaction_receipt['gasUsed'] - trancation_fee = gas_used*gas_price + trancation_fee = transaction_receipt.effectiveGasPrice*transaction_receipt.gasUsed tx_id = transaction_hash.hex() - return tx_id,trancation_fee + return tx_id,str(trancation_fee) except Exception as e: print({"error":str(e)}) return e diff --git a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-310.pyc new file mode 100644 index 0000000..1b63ebf Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-311.pyc deleted file mode 100644 index e8ae7c9..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-312.pyc new file mode 100644 index 0000000..aa41322 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-37.pyc deleted file mode 100755 index d41dd85..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-38.pyc deleted file mode 100755 index 7d38bf8..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/Conversion.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-310.pyc new file mode 100644 index 0000000..a105fb9 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-311.pyc deleted file mode 100644 index af1488a..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-312.pyc new file mode 100644 index 0000000..7bebeb0 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-37.pyc deleted file mode 100755 index dd79c60..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-38.pyc deleted file mode 100755 index 6711fd0..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/DataStorage.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/GetFromBlockChain.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/GetFromBlockChain.cpython-37.pyc deleted file mode 100755 index 77c8140..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/GetFromBlockChain.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/IPFSStorage.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/IPFSStorage.cpython-311.pyc deleted file mode 100755 index 7f3d53a..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/IPFSStorage.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/IPFSStorage.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/IPFSStorage.cpython-37.pyc deleted file mode 100755 index 3cea392..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/IPFSStorage.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-310.pyc old mode 100755 new mode 100644 index 5cfbf39..57f5260 Binary files a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-310.pyc and b/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-311.pyc deleted file mode 100644 index 292b8f6..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-312.pyc new file mode 100644 index 0000000..e77e69d Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-37.pyc deleted file mode 100755 index 322e28f..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-38.pyc deleted file mode 100755 index ded1e44..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/Narration.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-310.pyc new file mode 100644 index 0000000..2859da8 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-311.pyc deleted file mode 100644 index 4e44264..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-312.pyc new file mode 100644 index 0000000..fee87b8 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-37.pyc deleted file mode 100755 index bd23d22..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-38.pyc deleted file mode 100755 index 5034ed8..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/PPTConversion.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-311.pyc deleted file mode 100755 index a05f0b0..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-37.pyc deleted file mode 100755 index 3222eda..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-38.pyc deleted file mode 100755 index 4bd235f..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/ProjectCenter.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-311.pyc deleted file mode 100755 index 0b3363e..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-37.pyc deleted file mode 100755 index 409681b..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-38.pyc deleted file mode 100755 index 75f6230..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/WalletCreation.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/WriteOnBlockchain.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/WriteOnBlockchain.cpython-37.pyc deleted file mode 100755 index f32acd6..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/WriteOnBlockchain.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-310.pyc new file mode 100644 index 0000000..9d90a4f Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-311.pyc deleted file mode 100644 index eb089da..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-312.pyc new file mode 100644 index 0000000..2aedf0c Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-37.pyc deleted file mode 100755 index e59e83f..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/block_user_info.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-310.pyc similarity index 71% rename from kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-311.pyc rename to kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-310.pyc index 3fd3a28..306797e 100644 Binary files a/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-311.pyc and b/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-312.pyc new file mode 100644 index 0000000..64bcf37 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-37.pyc deleted file mode 100755 index 014bd53..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-38.pyc deleted file mode 100755 index 15134ca..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/blockchainsetting.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/decrypation.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/decrypation.cpython-37.pyc deleted file mode 100755 index 2db2e55..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/decrypation.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-310.pyc new file mode 100644 index 0000000..bab1874 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-311.pyc deleted file mode 100644 index 402f8f8..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-312.pyc new file mode 100644 index 0000000..ab0ecfb Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-37.pyc deleted file mode 100755 index bf46707..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-38.pyc deleted file mode 100755 index 0d3d9fc..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/decryption.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-310.pyc new file mode 100644 index 0000000..ff04f24 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-311.pyc deleted file mode 100755 index 53e5136..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-312.pyc b/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-312.pyc new file mode 100644 index 0000000..78791c8 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-312.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-37.pyc deleted file mode 100755 index f538460..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-38.pyc deleted file mode 100755 index ee69a54..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/scriptAudit.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/scriptpad.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/scriptpad.cpython-311.pyc deleted file mode 100644 index a19ff7c..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/scriptpad.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/serializers.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/serializers.cpython-310.pyc new file mode 100644 index 0000000..5059ca9 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/serializers.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/serializers.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/serializers.cpython-311.pyc deleted file mode 100644 index f43f68b..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/serializers.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/signals.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/signals.cpython-37.pyc deleted file mode 100755 index 07e7cba..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/signals.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-311.pyc deleted file mode 100755 index 4f98287..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-37.pyc deleted file mode 100755 index c29462f..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-38.pyc deleted file mode 100755 index df55a57..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/subtitle.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-311.pyc deleted file mode 100755 index a8fb22b..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-37.pyc deleted file mode 100755 index f6ab6d6..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-38.pyc b/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-38.pyc deleted file mode 100755 index 23f0966..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/transferMatic.cpython-38.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/urls.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000..f1d0c41 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/urls.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/urls.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/urls.cpython-311.pyc deleted file mode 100644 index 2c5edbb..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/urls.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/utils.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/utils.cpython-311.pyc deleted file mode 100755 index b41b7ff..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/utils.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/views.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/views.cpython-310.pyc new file mode 100644 index 0000000..3209e64 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/views.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/views.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/views.cpython-311.pyc deleted file mode 100644 index cfa0cd8..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/views.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-310.pyc b/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-310.pyc new file mode 100644 index 0000000..847fc29 Binary files /dev/null and b/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-310.pyc differ diff --git a/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-311.pyc b/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-311.pyc deleted file mode 100644 index 59fc3a6..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-311.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-37.pyc b/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-37.pyc deleted file mode 100755 index d0e9b0d..0000000 Binary files a/kitchen_counter/Blockchain2/__pycache__/web3User.cpython-37.pyc and /dev/null differ diff --git a/kitchen_counter/Blockchain2/block_user_info.py b/kitchen_counter/Blockchain2/block_user_info.py index 108a660..4ae30aa 100755 --- a/kitchen_counter/Blockchain2/block_user_info.py +++ b/kitchen_counter/Blockchain2/block_user_info.py @@ -11,7 +11,7 @@ class user_info: def update_info(self,request): obj= BlockchainUserInfo() # - if CorporateUser.objects.filter(user=request.user).exists(): + if CorporateUser.objects.filter(user= request.user).exists(): associated_corporate_users = CorporateUser.objects.get(user=request.user) obj.coprate_user = associated_corporate_users obj.user = request.user @@ -73,4 +73,4 @@ class CorporateUserInfo: ) return list(blockchain_info) except CorporateUser.DoesNotExist: - return None + return None \ No newline at end of file diff --git a/kitchen_counter/Blockchain2/decryption.py b/kitchen_counter/Blockchain2/decryption.py index e827615..6081f55 100755 --- a/kitchen_counter/Blockchain2/decryption.py +++ b/kitchen_counter/Blockchain2/decryption.py @@ -75,7 +75,7 @@ def decryptionOflocalUrl(hash): print(":::::::::::::::::::::",video_url) return video_url except: - return "http://127.0.0.1:8000/ipfs/QmZKWBEKQ28UixqGec6Qz9fEPsJktarzC8NSoFjJ1bgUQo" + return f"{DOWNLOAD_URL}/QmZKWBEKQ28UixqGec6Qz9fEPsJktarzC8NSoFjJ1bgUQo" def convertHexToBinary(binary): hextobainary = bytes.fromhex(binary) return hextobainary diff --git a/auto_email/__init__.py b/kitchen_counter/Blockchain2/error_check.txt similarity index 100% rename from auto_email/__init__.py rename to kitchen_counter/Blockchain2/error_check.txt diff --git a/kitchen_counter/Blockchain2/file_stroge.txt b/kitchen_counter/Blockchain2/file_stroge.txt index e69de29..dae52e8 100755 --- a/kitchen_counter/Blockchain2/file_stroge.txt +++ b/kitchen_counter/Blockchain2/file_stroge.txt @@ -0,0 +1,322 @@ +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------a30bfd1b-ea9a-43a9-bef0-af0e294a33f7 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x7c9B1E93d8bb9bc9D78Cc6dc2915A6cab7Df7EbF +audit public key-------------------3f14b62c3d7ab80713c4531898a2f5058a983a0e0b7da5adcf44041742260e2dcb65de9e2257d41f634725b610b1398ca0f696c66ca8cd765708df529bea09e0392d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x7c9B1E93d8bb9bc9D78Cc6dc2915A6cab7Df7EbF +audit public key-------------------3f14b62c3d7ab80713c4531898a2f5058a983a0e0b7da5adcf44041742260e2dcb65de9e2257d41f634725b610b1398ca0f696c66ca8cd765708df529bea09e0392d +5.index hash2-------------------{'script-original': {'screenplay_name': 'whiplash', 'author': 'abc', 'language': 'en', 'script_file_name': 'whiplash.docx', 'status': 'STARTED', 'script_id': '7627b187-119b-4ca5-bc02-e807754d7fae', 'script_file': 'f3030a4746e18abbeeda8776a217913805af40134b35ec0c2d1dc74b706f423a487bccf9a0f5292609ac997aad7a', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/7627b187-119b-4ca5-bc02-e807754d7fae/014_ZUpdk5V.docx', 'script_file_size': 22346}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/7627b187-119b-4ca5-bc02-e807754d7fae/220_gl9JPtF.docx', 'script_file': 'f303360644a6858d8bf59f17a91fbc3d27a256085240cb322519907e56554f330969d3c2bf8e6e114fd4a9598b48', 'type': 'script-docx', 'script_file_size': 40787}, 'script-csv': {'script_file': 'f303344522bdb79febf8bd3abd68b41530b957354c56fc173b1aab4b543037620a768a96adf652153380926bab5c', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/7627b187-119b-4ca5-bc02-e807754d7fae/e8f_MKyAquX.docx', 'type': 'audit-report', 'script_file_size': 10450}, 'audit-report': {'script_file': 'f303057411819dd1add1b536b46abe480da260084b74c3347c27b67b664322244b53e8ccbdda6d562f96ac5a9b18'}} +Transaction hash for audit is 0x11dd9e3b75c1e58bc85811d61586abba53c936684209d8f0a8005c4c6188f5f4 +Transaction hash for audit is + time for the above transaction id 2024-02-28 11:53:21 +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmZt17gR7EB9o1DBDUcuT7dMgR6Eai9k7jrVZH7CrKdZuS +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmZt17gR7EB9o1DBDUcuT7dMgR6Eai9k7jrVZH7CrKdZuS +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmZt17gR7EB9o1DBDUcuT7dMgR6Eai9k7jrVZH7CrKdZuS +1.user upload files-------------------('0xec343c438b04ab3b5a93b2c883e823b0ddae348bcf169c759b788ccbdf39141b', 282235503010512) +1.user file_id files-------------------('aq1',) +1.user file_id files-------------------aq1 +1.user file_id files-------------------('0xCe5D28611021a99418228d28479E81BE2D6e5af4', "{'cid_hash': 'QmYeppBEGrYjWtVPwzBsEcn55ii3cL8SgGMLM6seHTMWtM'}", True) +1.user file_id files-------------------('0xCe5D28611021a99418228d28479E81BE2D6e5af4', "{'cid_hash': 'QmYeppBEGrYjWtVPwzBsEcn55ii3cL8SgGMLM6seHTMWtM'}", True) +1.user file_id files-------------------('0xCe5D28611021a99418228d28479E81BE2D6e5af4', "{'cid_hash': 'QmYeppBEGrYjWtVPwzBsEcn55ii3cL8SgGMLM6seHTMWtM'}", True) +1.user file_id files-------------------('0xCe5D28611021a99418228d28479E81BE2D6e5af4', "{'cid_hash': 'QmYeppBEGrYjWtVPwzBsEcn55ii3cL8SgGMLM6seHTMWtM'}", True) +1.user file_id files-------------------('0xCe5D28611021a99418228d28479E81BE2D6e5af4', "{'cid_hash': 'QmYeppBEGrYjWtVPwzBsEcn55ii3cL8SgGMLM6seHTMWtM'}", True) +1.user file_id files-------------------('0xCe5D28611021a99418228d28479E81BE2D6e5af4', "{'cid_hash': 'QmYeppBEGrYjWtVPwzBsEcn55ii3cL8SgGMLM6seHTMWtM'}", True) +1.user file_id files-------------------('0xCe5D28611021a99418228d28479E81BE2D6e5af4', "{'cid_hash': 'QmYeppBEGrYjWtVPwzBsEcn55ii3cL8SgGMLM6seHTMWtM'}", True) +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------a30bfd1b-ea9a-43a9-bef0-af0e294a33f7 +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------a30bfd1b-ea9a-43a9-bef0-af0e294a33f7 +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------a30bfd1b-ea9a-43a9-bef0-af0e294a33f7 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +5.index hash2-------------------{'script-original': {'screenplay_name': 'New File 1', 'author': 'Rohan', 'language': 'en', 'script_file_name': 'New File 1.txt', 'status': 'STARTED', 'script_id': '06e09f1b-1530-4757-8046-7d9ac04b77e6', 'script_file': 'f3030565249a89b8a0f5b52d8e52b4122f9048537a3aef133a2ea058655e21252660d3d682842a0637a597199d4d', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/06e09f1b-1530-4757-8046-7d9ac04b77e6/4445_9n8krdV.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/06e09f1b-1530-4757-8046-7d9ac04b77e6/839_NiDqiPy.docx', 'script_file': 'f303064200e5d89888d3ad07fb54873129ac772c7c66e300782ba656554b2f120b6986cc8cdb44003daf9f14bd5b', 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': 'f30306743b87d4adb6e5b02785638242739f4e072644c60b1939b374525c08161820d197a9ce761c15be9f138b1e', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/06e09f1b-1530-4757-8046-7d9ac04b77e6/dfc_DMmGGsy.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': 'f303346743859eaceaf5891d8844a44d07b252546e7ad9122129a85c6753331510498bc4c8ed280836deb965ea48'}} +Transaction hash for audit is 0xd68d283ea56b96d14254fcbc620580a4add7315229b1039c757f36f070d94da9 +Transaction hash for audit is + time for the above transaction id 2024-02-29 11:45:38 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +5.index hash2-------------------{'script-original': {'screenplay_name': 'Scr 111', 'author': 'Rohan', 'language': 'en', 'script_file_name': 'Scr 111.docx', 'status': 'STARTED', 'script_id': '31831b5f-174e-4fdc-9934-6e77faf1079b', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/31831b5f-174e-4fdc-9934-6e77faf1079b/6ce_UsZzRdN.docx', 'script_file_size': 32154}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/31831b5f-174e-4fdc-9934-6e77faf1079b/28a_JiJtT6I.docx', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-docx', 'script_file_size': 37793}, 'script-csv': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/31831b5f-174e-4fdc-9934-6e77faf1079b/cab_QnKGi07.docx', 'type': 'audit-report', 'script_file_size': 2730}, 'audit-report': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))"}} +Transaction hash for audit is 0x8a0e83e00944e784eb700e8835a592f3f9f016729b45b2a65bdfce01bc05ccdf +Transaction hash for audit is + time for the above transaction id 2024-02-29 12:05:08 +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------a30bfd1b-ea9a-43a9-bef0-af0e294a33f7 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +5.index hash2-------------------{'script-original': {'screenplay_name': 'test', 'author': 'testauthor', 'language': 'en', 'script_file_name': 'test.docx', 'status': 'STARTED', 'script_id': '4719e61b-c8b7-44e3-a4ea-fad022454495', 'script_file': 'f303095607a6afac9eed9c259a52832a368061155a61e6747f26983d724a43021856f3e3b78b6d0033b3b077ac64', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/4719e61b-c8b7-44e3-a4ea-fad022454495/b6e_BN9Hcym.docx', 'script_file_size': 31794}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/4719e61b-c8b7-44e3-a4ea-fad022454495/b3d_tOWl5uD.docx', 'script_file': 'f303356643b1a08793f69c38bc77e21c2e975b336870c5360e05c6667e4c12010a72d0d79fcb6f142faa97549f62', 'type': 'script-docx', 'script_file_size': 37587}, 'script-csv': {'script_file': 'f303000530efdf80ebf09318f544a03d20c95108524fc029203ca75e454c4a663975edf6bdf84d2b158088779341', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/4719e61b-c8b7-44e3-a4ea-fad022454495/0d2_now6dNt.docx', 'type': 'audit-report', 'script_file_size': 2094}, 'audit-report': {'script_file': 'f303065c31a6dcb0bbc7aa3ffc52b710169955345874f2360418873b20574c63265b8aedb98f4a0e09a18d62b37d'}} +Transaction hash for audit is 0x20e3928f1b3ab683480319569f1b7c7145d4c015df405cec485042f49c2259e2 +Transaction hash for audit is + time for the above transaction id 2024-02-29 17:09:20 +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------a30bfd1b-ea9a-43a9-bef0-af0e294a33f7 +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------2b2a0637-13dd-4fb7-965f-694e47272a7c +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmZt17gR7EB9o1DBDUcuT7dMgR6Eai9k7jrVZH7CrKdZuS +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmZt17gR7EB9o1DBDUcuT7dMgR6Eai9k7jrVZH7CrKdZuS +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------5a184ae8-434d-45df-95f5-e79ff611972a +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmZt17gR7EB9o1DBDUcuT7dMgR6Eai9k7jrVZH7CrKdZuS +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/Qmf53phdRjZXd9iGfXunMBCsoVapGS4bvxmmE3pt43TySa +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +5.index hash2-------------------{'script-original': {'screenplay_name': 'hgyuguigt', 'author': 'Rohan', 'language': 'en', 'script_file_name': 'hgyuguigt.txt', 'status': 'STARTED', 'script_id': 'fabbfbbb-6cf8-4de2-8de5-478cbb23bd55', 'script_file': 'f3030565249a89b8a0f5b52d8e52b4122f9048537a3aef133a2ea058655e21252660d3d682842a0637a597199d4d', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/fabbfbbb-6cf8-4de2-8de5-478cbb23bd55/e02c_ZXUjSqc.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/fabbfbbb-6cf8-4de2-8de5-478cbb23bd55/45e_3vvR9fn.docx', 'script_file': 'f303324007b1848a9feeb17988619d3118bf4e0f2949c638237bb076666f0d393177f4e88dc8272b31d2b014ea50', 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': 'f30306743b87d4adb6e5b02785638242739f4e072644c60b1939b374525c08161820d197a9ce761c15be9f138b1e', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/fabbfbbb-6cf8-4de2-8de5-478cbb23bd55/77f_VKMjnSB.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': 'f3031e4640a386bab0a8bf0d9a62ed2323c96b36483bc2040b08c042554d0a6415708fc192f954232383af4aae7d'}} +Transaction hash for audit is 0x9266ef1be1aa5e0fba70d36121f2440644440b7450dd41540643946266af771b +Transaction hash for audit is + time for the above transaction id 2024-02-29 18:04:38 +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------2b2a0637-13dd-4fb7-965f-694e47272a7c +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmZt17gR7EB9o1DBDUcuT7dMgR6Eai9k7jrVZH7CrKdZuS +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/Qmf53phdRjZXd9iGfXunMBCsoVapGS4bvxmmE3pt43TySa +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------7627b187-119b-4ca5-bc02-e807754d7fae +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs//QmZKWBEKQ28UixqGec6Qz9fEPsJktarzC8NSoFjJ1bgUQo +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +5.index hash2-------------------{'script-original': {'screenplay_name': '122', 'author': 'ddd', 'language': 'en', 'script_file_name': '122.txt', 'status': 'STARTED', 'script_id': 'c6d4b227-cc33-4ca6-9635-dff397eb9303', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/c6d4b227-cc33-4ca6-9635-dff397eb9303/4fd4_shrLsbZ.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/c6d4b227-cc33-4ca6-9635-dff397eb9303/718_kKxPf3o.docx', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/c6d4b227-cc33-4ca6-9635-dff397eb9303/c68_bAwpRY5.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))"}} +Transaction hash for audit is 0x0c54acc739451a995ab2c7dd3c07c6411ee43c2754c74ffd37bec81f31d78d8d +Transaction hash for audit is + time for the above transaction id 2024-03-01 09:59:15 +1.user private key-------------------b'0x98316475d2848fdf17b39aa070f4b2522c389b04a3592f7cf949fa5837511e96' +1.user script_id -------------------c6d4b227-cc33-4ca6-9635-dff397eb9303 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +5.index hash2-------------------{'script-original': {'screenplay_name': 'yuuuuyy', 'author': 'hvhvv', 'language': 'en', 'script_file_name': 'yuuuuyy.txt', 'status': 'STARTED', 'script_id': '4ec7ac85-68cd-42fb-b436-e102639465b2', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/4ec7ac85-68cd-42fb-b436-e102639465b2/c80f_FwRluBf.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/4ec7ac85-68cd-42fb-b436-e102639465b2/dcd_QAw80Bg.docx', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/4ec7ac85-68cd-42fb-b436-e102639465b2/e30_b3EqA1G.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))"}} +Transaction hash for audit is 0x1c59ce60499a996fef3a1d48d1e595159f915d6d0698b31b03d447ea33669d03 +Transaction hash for audit is + time for the above transaction id 2024-03-05 13:23:10 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4719e61b-c8b7-44e3-a4ea-fad022454495 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4719e61b-c8b7-44e3-a4ea-fad022454495 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4ec7ac85-68cd-42fb-b436-e102639465b2 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4ec7ac85-68cd-42fb-b436-e102639465b2 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4ec7ac85-68cd-42fb-b436-e102639465b2 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4ec7ac85-68cd-42fb-b436-e102639465b2 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4ec7ac85-68cd-42fb-b436-e102639465b2 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------4ec7ac85-68cd-42fb-b436-e102639465b2 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +5.index hash2-------------------{'script-original': {'screenplay_name': 'Scrt', 'author': 'Rohan', 'language': 'en', 'script_file_name': 'Scrt.txt', 'status': 'STARTED', 'script_id': '83b4d679-4866-4c72-b0a2-2f5d8a2344ef', 'script_file': 'f3030565249a89b8a0f5b52d8e52b4122f9048537a3aef133a2ea058655e21252660d3d682842a0637a597199d4d', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/83b4d679-4866-4c72-b0a2-2f5d8a2344ef/af5a_CmaAkXb.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/83b4d679-4866-4c72-b0a2-2f5d8a2344ef/043_mztSY0d.docx', 'script_file': 'f303056242be9f83acdca8208872800c0f8070364a49e325730a875c44563c250e498ac5cec57c151d82ce549611', 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': 'f30306743b87d4adb6e5b02785638242739f4e072644c60b1939b374525c08161820d197a9ce761c15be9f138b1e', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/83b4d679-4866-4c72-b0a2-2f5d8a2344ef/e72_bDZTLrQ.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': 'f3030a563594dfa594dd9c0aa073e04f34aa152d7977c2313237b446734e381a0f7afafe88f3521702d5ae19ad1a'}} +Transaction hash for audit is 0xde9e705942188d0da0daaabddbd401043aa75770174f91b589b67cb450780857 +Transaction hash for audit is + time for the above transaction id 2024-03-05 13:44:24 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------83b4d679-4866-4c72-b0a2-2f5d8a2344ef +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmUVSLdQyjpbCtahnjk5e8gRpaQVtXZtYqmyx94cLBj9Ed +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------83b4d679-4866-4c72-b0a2-2f5d8a2344ef +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmUVSLdQyjpbCtahnjk5e8gRpaQVtXZtYqmyx94cLBj9Ed +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +5.index hash2-------------------{'script-original': {'screenplay_name': 'Tio', 'author': 'Rohan', 'language': 'en', 'script_file_name': 'Tio.txt', 'status': 'STARTED', 'script_id': '441014f5-2364-4d27-884f-df802f2a35e4', 'script_file': 'f3030565249a89b8a0f5b52d8e52b4122f9048537a3aef133a2ea058655e21252660d3d682842a0637a597199d4d', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/441014f5-2364-4d27-884f-df802f2a35e4/e355_ELu26se.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/441014f5-2364-4d27-884f-df802f2a35e4/7cd_WnfhBBU.docx', 'script_file': 'f303326910a4de8aebfdfd1ea36b850006bc772c6940fc3b0628b959403712023a69e69eb1f75c24129f8f44a947', 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': 'f30306743b87d4adb6e5b02785638242739f4e072644c60b1939b374525c08161820d197a9ce761c15be9f138b1e', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/441014f5-2364-4d27-884f-df802f2a35e4/b8b_uALlJWj.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': 'f303024442e1bd99b7cb8108aa57ac1373b253005e75d878397a986d7f560c3e2c7ac4dbcee464573d8a8b68e979'}} +Transaction hash for audit is 0x3826a820d4f9184450729d24a53a0692ee0642a34f0c8a50749de92112d2835f +Transaction hash for audit is + time for the above transaction id 2024-03-05 14:32:21 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +5.index hash2-------------------{'script-original': {'screenplay_name': 'The MNF', 'author': 'Rohan', 'language': 'en', 'script_file_name': 'The MNF.txt', 'status': 'STARTED', 'script_id': '72f18be0-c0e7-4af7-8f94-e382128bb4a6', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/72f18be0-c0e7-4af7-8f94-e382128bb4a6/eb4d_FZ9bmrA.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/72f18be0-c0e7-4af7-8f94-e382128bb4a6/fa2_juddflv.docx', 'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/72f18be0-c0e7-4af7-8f94-e382128bb4a6/b16_twtPDlj.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': "ConnectionError: HTTPConnectionPool(host='localhost', port=5001): Max retries exceeded with url: /api/v0/version?stream-channels=true (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))"}} +Transaction hash for audit is 0xa9a11f33bf4658625d2ec906b4f5d30ac2ff63a60cac64ebaad188909ed7bf6b +Transaction hash for audit is + time for the above transaction id 2024-03-06 16:56:09 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------72f18be0-c0e7-4af7-8f94-e382128bb4a6 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x4dA7a0ec89E865D6acB6253064865590bd7f9452 +audit public key-------------------3f14b02c3929b8571497044b98a4f90cdecb6a085b22a6ffcc160c45172f5c2cce318c972608d31163462eb017eb3e8cf0f294c169afcd21025ed808cdee0ee36d7d +5.index hash2-------------------{'script-original': {'screenplay_name': 'Scr 1167', 'author': 'Rohan', 'language': 'en', 'script_file_name': 'Scr 1167.docx', 'status': 'STARTED', 'script_id': '72d78d60-ecf4-4a94-aaac-e559a2bb77fd', 'script_file': 'f30300550ea6d8aba3f98905af15e34d258917167534d9773d02a55979344d274841d4cebced6c5c2284cb55ed5b', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/72d78d60-ecf4-4a94-aaac-e559a2bb77fd/449_vsSHACr.docx', 'script_file_size': 32154}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/72d78d60-ecf4-4a94-aaac-e559a2bb77fd/ff6_N1V4lU7.docx', 'script_file': 'f303084b46bf9aabeff6af1b987ee02e7280470b7631db222e3bbf5965673e022727f4dcc2e826533895c4138b6c', 'type': 'script-docx', 'script_file_size': 37793}, 'script-csv': {'script_file': 'f30302714fb2a39aa9f29176a360813703a8611e4f6fe5147308c942683421080b4688c9a8db562219acca538079', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/72d78d60-ecf4-4a94-aaac-e559a2bb77fd/5e9_s9tspcy.docx', 'type': 'audit-report', 'script_file_size': 2730}, 'audit-report': {'script_file': 'f303084146918cd8a8edf01faa77b1082eaa1b152e30db280e39837a567415012c57ffc883fb533530a187438967'}} +Transaction hash for audit is 0xed0af5caace77f63d55d521cbb2511cea3458e55bcd3108e80b83fcf1623b374 +Transaction hash for audit is + time for the above transaction id 2024-03-06 17:53:14 +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------72d78d60-ecf4-4a94-aaac-e559a2bb77fd +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmPfyp5BzfLJb367ds4pj6Q6wMTWh26v7PjaFPr9Yc6u5r +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------72d78d60-ecf4-4a94-aaac-e559a2bb77fd +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmXx1iwB6ijTUX5T3zdmi3ScdtNWtaESX6Js8U86Cr93SE +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------72d78d60-ecf4-4a94-aaac-e559a2bb77fd +1.gasfee file_uploading_end-------------------http://127.0.0.1:8000/ipfs/QmXx1iwB6ijTUX5T3zdmi3ScdtNWtaESX6Js8U86Cr93SE +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------72d78d60-ecf4-4a94-aaac-e559a2bb77fd +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------72d78d60-ecf4-4a94-aaac-e559a2bb77fd +1.user private key-------------------b'0x27fb433b3783481ff02ffb3f01f84d2b18afa833312c47fe623796fed9c7caa2' +1.user script_id -------------------72d78d60-ecf4-4a94-aaac-e559a2bb77fd +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +1.user private key-------------------b'0x47b14c41dd8581e566b9e0048c31fe76c1e9f6328759376a45609a33cc53db5b' +1.user script_id -------------------2b2a0637-13dd-4fb7-965f-694e47272a7c +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------0x789e1eb4d19f76910da1A3Ed8f64F2a480C6eEdC +audit public key-------------------3f14bb236c7aba5010c0534e98a3f5528bcb3d0f0b77f9fc9e400b4417230a7ac9618fcc74568b4b60417cb210b138dda1f4c4ca6ea1927651038f069be85ce73579 +5.index hash2-------------------{'script-original': {'screenplay_name': 'tryubino', 'author': 'rrytvubi', 'language': 'en', 'script_file_name': 'tryubino.txt', 'status': 'STARTED', 'script_id': '5619d792-6389-4160-87e3-d0bf5cdc2afe', 'script_file': 'f3030565249a89b8a0f5b52d8e52b4122f9048537a3aef133a2ea058655e21252660d3d682842a0637a597199d4d', 'type': 'script-original', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/5619d792-6389-4160-87e3-d0bf5cdc2afe/42a8_DFGSeIN.txt', 'script_file_size': 3954}, 'script-docx': {'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/5619d792-6389-4160-87e3-d0bf5cdc2afe/b7c_NPrOp0Y.docx', 'script_file': 'f30307591ca2a6b8bcce9f0d977f9800759844365c3ae1222378803765642e1c2b7fe8ddabef64063983b153a11a', 'type': 'script-docx', 'script_file_size': 37802}, 'script-csv': {'script_file': 'f30306743b87d4adb6e5b02785638242739f4e072644c60b1939b374525c08161820d197a9ce761c15be9f138b1e', 'script_file_path': '/home/mnfidea/project/MNF/media/scripts_folder/5619d792-6389-4160-87e3-d0bf5cdc2afe/7c7_7372w58.docx', 'type': 'audit-report', 'script_file_size': 2768}, 'audit-report': {'script_file': 'f303336522b99adfb2c59239fa48e0193b9e4b1f4b4cfd047b22886147501d341a22db98a2ca695129bf8c48be1d'}} +Transaction hash for audit is 0x3a72ede10ce0292102b87173a752decfe6f1a4811d5fcdba8f6a9b1f24a1ea68 +Transaction hash for audit is + time for the above transaction id 2024-03-08 19:02:30 +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey-------------------ideamall.Showcase.None +audit userkey------------------SUCCESS1 +{'script-original': {'status': 'STARTED', 'script_id': '8b33544b-ef3e-431a-8b87-1e3362fda354', 'script_file': 'f303317b4eb18bddbbedbf0187578718209c4b25693ae20924768161723539101d61c4f7bce46f5c1590b141ab73', 'type': 'script-original', 'script_file_path': '/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/media/audit_counter_files/may08order1.docx'}, 'script-docx': {'script_file_path': '/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/media/scripts_folder/8b33544b-ef3e-431a-8b87-1e3362fda354/50403d2c-81d5-46bb-809d-2ebe3211ad41.docx', 'script_file': 'f303347e429885b0aac7a027fe51a23f29bb4b27745be6067e02a14a567c10031a62c6fdb0fa6d1f4edfb314af18', 'type': 'script-docx'}, 'script-csv': {'script_file': 'f3030a610285a588b4fbfc298b5e91380fcc51547056ee143b2ec57d2963481b4670ddd8a8ce2f3c138dad68a21b', 'script_file_path': '/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/media/scripts_folder/8b33544b-ef3e-431a-8b87-1e3362fda354/4da79712-fadb-49f6-b7ec-c79249de9343.docx', 'type': 'audit-report'}, 'audit-report': {'script_file': 'f303086a24a38c908bd19d1ff560b7312689693f597aee133e1eb948495731160f47d5c2c2c964233eacb55a935a'}} +audit userkey------------------SUCCESS +0xbdc328ca54ecfc57159a6d4d25d77ac7ee59448e91e13a4318634a9d17fc8867 \ No newline at end of file diff --git a/kitchen_counter/Blockchain2/scriptAudit.py b/kitchen_counter/Blockchain2/scriptAudit.py index 458d4d3..a546653 100755 --- a/kitchen_counter/Blockchain2/scriptAudit.py +++ b/kitchen_counter/Blockchain2/scriptAudit.py @@ -1,14 +1,21 @@ from web3 import Web3 import time -# web3 = Web3(Web3.HTTPProvider("https://polygon-mainnet.infura.io/v3/017957497a0d4e9c80750c18a431ac1e")) -web3 = Web3(Web3.HTTPProvider("https://rpc-mumbai.maticvigil.com/")) + +RPC = 'https://rpc-amoy.polygon.technology/' +CONTRACT_ADDRESS = '0xbE91e2294D12fa78Ce64657fD9Ee137cE3e99881' +CHAIN_ID = 80002 +ABI = '[ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "project", "type": "string" }, { "indexed": false, "internalType": "string", "name": "data", "type": "string" } ], "name": "conversion", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "pubKey", "type": "address" }, { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" }, { "internalType": "string", "name": "_data", "type": "string" } ], "name": "UploadScriptAuditData", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" } ], "name": "deleteScriptAudit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "userId", "type": "uint256" } ], "name": "getProjectId", "outputs": [ { "internalType": "string[]", "name": "", "type": "string[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" } ], "name": "getScriptAudit", "outputs": [ { "components": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "string", "name": "mydata", "type": "string" }, { "internalType": "bool", "name": "Write", "type": "bool" } ], "internalType": "struct ScriptAuditDataBase.privateData", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" } ]' +# web3 = Web3(Web3.HTTPProvider("https://polygon-mainnet.infura.io/v3/017957497a0d4e9c80750c18a431ac1e")) +# web3 = Web3(Web3.HTTPProvider("https://rpc-mumbai.maticvigil.com/")) +web3 = Web3(Web3.HTTPProvider(RPC)) + # mainnet # CAddress = '0x3a5d033CdF38aC4a9fe116CE88EBA2E93260044c' # abi = '[ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "project", "type": "string" }, { "indexed": false, "internalType": "string", "name": "data", "type": "string" } ], "name": "conversion", "type": "event" }, { "inputs": [ { "internalType": "address", "name": "pubKey", "type": "address" }, { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" }, { "internalType": "string", "name": "_data", "type": "string" } ], "name": "UploadScriptAuditData", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" } ], "name": "deleteScriptAudit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "userId", "type": "uint256" } ], "name": "getProjectId", "outputs": [ { "internalType": "string[]", "name": "", "type": "string[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" } ], "name": "getScriptAudit", "outputs": [ { "components": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "string", "name": "mydata", "type": "string" }, { "internalType": "bool", "name": "Write", "type": "bool" } ], "internalType": "struct ScriptAuditDataBase.privateData", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" } ]' -CAddress = '0xa4Bab61e2E324E0967CA28Fc2beE62A51092f9f3' -abi = '[ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "project", "type": "string" }, { "indexed": false, "internalType": "string", "name": "data", "type": "string" } ], "name": "conversion", "type": "event" }, { "inputs": [ { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" } ], "name": "deleteScriptAudit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "pubKey", "type": "address" }, { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" }, { "internalType": "string", "name": "_data", "type": "string" } ], "name": "UploadScriptAuditData", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "userId", "type": "uint256" } ], "name": "getProjectId", "outputs": [ { "internalType": "string[]", "name": "", "type": "string[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "user_id", "type": "uint256" }, { "internalType": "string", "name": "project", "type": "string" } ], "name": "getScriptAudit", "outputs": [ { "components": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "string", "name": "mydata", "type": "string" }, { "internalType": "bool", "name": "Write", "type": "bool" } ], "internalType": "struct ScriptAuditDataBase.privateData", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" } ]' +CAddress =CONTRACT_ADDRESS +abi = ABI contractInst = web3.eth.contract(address=CAddress, abi=abi) def UploadScriptAuditData(privatekey,pubkey,user_id,project,data): @@ -17,13 +24,14 @@ def UploadScriptAuditData(privatekey,pubkey,user_id,project,data): acc1 = web3.eth.account.from_key(privatekey).address nonce = web3.eth.get_transaction_count(acc1) uploadData = contractInst.functions.UploadScriptAuditData(pubkey,user_id,project,data).build_transaction({ - 'gasPrice': web3.eth.gas_price, 'chainId': 80001, 'from': acc1, 'nonce': nonce}) + 'gasPrice': web3.eth.gas_price, 'chainId': CHAIN_ID, 'from': acc1, 'nonce': nonce}) signed_transaction = web3.eth.account.sign_transaction(uploadData, private_key=privatekey) transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) print("transaction hash",transaction_hash) transaction_receipt = web3.eth.wait_for_transaction_receipt(transaction_hash) + trancation_fee = transaction_receipt.effectiveGasPrice*transaction_receipt.gasUsed tx_id = transaction_hash.hex() - return tx_id + return tx_id,str(trancation_fee) except Exception as e: # print({"error":str(e)}) return e @@ -50,7 +58,7 @@ def deleteScriptAudit(privatekey,user_id,project): acc1 = web3.eth.account.from_key(privatekey).address nonce = web3.eth.getTransactionCount(acc1) deleteData = contractInst.functions.deleteScriptAudit(user_id,project).buildTransaction({ - 'gasPrice': web3.eth.gas_price, 'chainId': 80001, 'from': acc1, 'nonce': nonce}) + 'gasPrice': web3.eth.gas_price, 'chainId': CHAIN_ID, 'from': acc1, 'nonce': nonce}) signed_transaction = web3.eth.account.sign_transaction(deleteData, private_key=privatekey) transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) transaction_receipt = web3.eth.wait_for_transaction_receipt(transaction_hash) @@ -60,4 +68,7 @@ def deleteScriptAudit(privatekey,user_id,project): print({"PPT_conversion_delete_error":str(e)}) # UploadScriptAuditData("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",1,'1752aa50-a751-4149-84ad-680dcb932972',"fhdsjkdfd") -# getScriptAudit("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",2,'1752aa50-a751-4149-84ad-680dcb932972') \ No newline at end of file +# getScriptAudit("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",2,'1752aa50-a751-4149-84ad-680dcb932972') +# script = UploadScriptAuditData("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",'0xd7F252B08B19e35344ac44DE7CCdd26D10Cc6e17',1,'1752aa50-a751-4149-84ad-680dcb932972',"fhdsjkdfd") +# print(script) +# getScriptAudit("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",1,'1752aa50-a751-4149-84ad-680dcb932972') diff --git a/kitchen_counter/Blockchain2/scriptpad.py b/kitchen_counter/Blockchain2/scriptpad.py index 83a592f..7474f34 100755 --- a/kitchen_counter/Blockchain2/scriptpad.py +++ b/kitchen_counter/Blockchain2/scriptpad.py @@ -25,8 +25,9 @@ def UploadScriptPadData(privatekey,pubkey,user_id,project,data): transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) print("transaction hash",transaction_hash) transaction_receipt = web3.eth.wait_for_transaction_receipt(transaction_hash) + trancation_fee= transaction_receipt.effectiveGasPrice*transaction_receipt.gasUsed tx_id = transaction_hash.hex() - return tx_id + return tx_id,str(trancation_fee) except Exception as e: # print({"error":str(e)}) return e diff --git a/kitchen_counter/Blockchain2/views.py b/kitchen_counter/Blockchain2/views.py index 1fe460e..2a4c2cd 100755 --- a/kitchen_counter/Blockchain2/views.py +++ b/kitchen_counter/Blockchain2/views.py @@ -16,6 +16,9 @@ from .serializers import UserCredentialsForBlockchainSerializer, BlockchainUserI from Blockchain2.block_user_info import * from Blockchain2.web3User import * from django.contrib.auth import get_user_model +from lpp.certificate.createCertificate import certificateGenrate +from auto_email.views import sendmail + User = get_user_model() @@ -33,14 +36,10 @@ class BlockchainUserFilterView(generics.ListCreateAPIView): if CorporateMember.objects.filter(user=self.request.user).exists(): - print("I am herw") corporate_member = CorporateMember.objects.get(user=self.request.user) corporate_users = CorporateUser.objects.filter(this_user_admin_id=corporate_member.corporate_member_uuid) - print("I am hereeeee", corporate_users, corporate_member, corporate_member.corporate_member_uuid) corporate_user_ids = corporate_users.values_list('user_id', flat=True) - print("madihaaaaaaa", corporate_user_ids) queryset = queryset.filter(user_id__in=corporate_user_ids) - print("huehue", corporate_user_ids, queryset) if service_param: serialized_data = self.get_serializer(queryset, many=True).data @@ -177,8 +176,22 @@ class GetUserTypeView(APIView): def update_blockchain_info(request): try: - user_infos = user_info(tx_hash="0x556facdba65b25dfb366d67f2798bf626153722d1c2ef7b2f58a42640a01dfa9", service="Narration", gas_fee=554435321,script_name = "Narration project") + gas= 12 + user_infos = user_info(tx_hash="0x556facdba65b25dfb366d67f2798bf626153722d1c2ef7b2f58a42640a01dfa9", service="Narration", gas_fee=str(gas),script_name = "Narration project") addition_result = user_infos.update_info(request) + # certificatepath = certificateGenrate(request.user.username, "script conversion", "0x556facdba65b25dfb366d67f2798bf626153722d1c2ef7b2f58a42640a01dfa9") + # certificatepath = certificateGenrate(request.user.username, "script conversion", hash) + # hash = hash_decrypation(hash) + # to_email = [request.user.email] + # email_code = 'BL1' + # key_value = { + # "service": "script conversion", + # "hash": "hash", + # "public key": "", + # "private key": "", + # "Transaction Hash": "0x556facdba65b25dfb366d67f2798bf626153722d1c2ef7b2f58a42640a01dfa9" + # } + # sendmail(to_email=to_email, email_code=email_code, key_value=key_value, filePath=certificatepath) return HttpResponse(f"info=>sucessfully updated for {request.user}") except Exception as e: print("Error:",e) diff --git a/kitchen_counter/MNF/.env b/kitchen_counter/MNF/.env index 097fcba..8da6e19 100755 --- a/kitchen_counter/MNF/.env +++ b/kitchen_counter/MNF/.env @@ -30,16 +30,16 @@ TWILIO_ACCOUNT_SID = "AC16b61a92dc52370bd14965a8b9ae5d96" TWILIO_AUTH_TOKEN = "b5588ba9085ab17d2f45321befa2f514" TWILIO_PHONE_NUMBER = "+12766001643" -EMAIL_HOST_USER = 'development@mynextfilm.ai' -EMAIL_HOST_PASSWORD = 'Mynextfilm@1' +EMAIL_HOST_USER = 'noreply@mynextfilm.ai' +EMAIL_HOST_PASSWORD = 'Noreply@mnf123' SMTP_HOST='smtp.gmail.com' SMTP_PORT='587' -SMTP_USERNAME='development@mynextfilm.ai' -SMTP_PASSWORD='mokv cdjr dele sswp' +SMTP_USERNAME='noreply@mynextfilm.ai' +SMTP_PASSWORD='iiby yciy jdux fslv' -CSRF_TRUSTED_ORIGINS='http://1.6.141.104' +CSRF_TRUSTED_ORIGINS='https://app.mynextfilm.ai' MONTHLY_MEMBER=1 # 1$ EMPLOY_DISCOUNT=50 # staff discount we give diff --git a/kitchen_counter/MNF/settings.py b/kitchen_counter/MNF/settings.py index bd16afc..f8f0022 100755 --- a/kitchen_counter/MNF/settings.py +++ b/kitchen_counter/MNF/settings.py @@ -649,6 +649,7 @@ smtp_host = os.environ.get('SMTP_HOST') smtp_port = int(os.environ.get('SMTP_PORT')) smtp_username = os.environ.get('SMTP_USERNAME') smtp_password = os.environ.get('SMTP_PASSWORD') +#EMAIL_USE_SSL = True COUNTRY_KEY = "00000000000000000000000000000000" diff --git a/kitchen_counter/auto_email/email/EMAILSheet39.xlsx b/kitchen_counter/auto_email/email/EMAILSheet39.xlsx index 13abb97..373bd44 100644 Binary files a/kitchen_counter/auto_email/email/EMAILSheet39.xlsx and b/kitchen_counter/auto_email/email/EMAILSheet39.xlsx differ diff --git a/kitchen_counter/auto_email/views.py b/kitchen_counter/auto_email/views.py index 8f50505..cca2069 100755 --- a/kitchen_counter/auto_email/views.py +++ b/kitchen_counter/auto_email/views.py @@ -117,7 +117,8 @@ def mailer(all_email,email_code,key_value,filePath): auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code is not present in any sheet") return print('Email code is not present in any sheet') row_data = row_data.fillna('') - from_email = row_data.iloc[0, 3] + #from_email = row_data.iloc[0, 3] + from_email = 'noreply@mynextfilm.ai' additional_option_code = row_data.iloc[0, 7] option_file = pd.read_excel( file_path, sheet_name='Common Options', header=1) @@ -158,9 +159,11 @@ def mailer(all_email,email_code,key_value,filePath): host = email_data.iloc[0, 1] port = int(email_data.iloc[0, 2]) password = emails_creadentials.objects.get(email=from_email) + print("before connection") connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) # send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,to=[to_email],connection=connection) + print("after connection") sendMail.attach_alternative(msg_html,"text/html") if filePath is not None: sendMail.attach_file(f'{filePath}') @@ -219,6 +222,7 @@ def mailer(all_email,email_code,key_value,filePath): print('mnf_not') mnf_notification.save() print("sendmail1") + print("before send mail") sendMail.send() print('done compete notification') diff --git a/kitchen_counter/conversion/management/commands/custom_runserver.py b/kitchen_counter/conversion/management/commands/custom_runserver.py index 1bbf534..91549e9 100755 --- a/kitchen_counter/conversion/management/commands/custom_runserver.py +++ b/kitchen_counter/conversion/management/commands/custom_runserver.py @@ -97,12 +97,12 @@ def run_audit(msg): file_content = file.read() file = ContentFile( - file_content, - script_file_name, - ) - user = User.objects.get(username=user) - # user_id = user.id + file_content, + script_file_name, + ) + user = User.objects.get(username=user) + result = filesystem.new_screenplay_without_audit_in_background( user, author, @@ -127,15 +127,19 @@ def run_audit(msg): try: - naudit = NeutralAudit(script_id) - naudit.audit_in_background() + + audit = NeutralAudit(script_id) + audit.audit_in_background() ScriptAuditModel.objects.update_or_create( script = Script.objects.get( id = script_id ), defaults={"status" : "SUCCESS"} ) - + msg.delete() + + + except: ScriptAuditModel.objects.update_or_create( script = Script.objects.get( @@ -143,35 +147,30 @@ def run_audit(msg): ), defaults={"status" : "FAILURE"} ) + status = ScriptAuditModel.objects.get( - script = Script.objects.get( - id = script_id - )) - - - # blockchain + script = Script.objects.get( + id = script_id + )) + print("STATUS AUDIT",status) + # Blockchain + # if UserCredentialsForBlockchain.objects.filter(user=request.user).exists(): blockchain_obj = UserCredentialsForBlockchain.objects.get(user=user) script_original= {} audit_data={} script_original["status"] = "STARTED" script_original["script_id"] = script_id - with open(local_file_path, 'rb') as file: + with open(file_to_original.file.path, 'rb') as file: hash = uploadDataToIPFSNode(file) script_original["script_file"] = hash script_original["type"] = "script-original" - script_original["script_file_path"] = local_file_path + script_original["script_file_path"] = file_to_original.file.path audit_data["script-original"] = script_original userkey= decryptionOfPrivate(blockchain_obj.privateKey) print("userkey = ", str(userkey)) - # status,getData = getScriptAudit(userkey.decode('utf-8'),user_id,str(script_id)) - # privatekeyfordb = userkey.decode('utf-8') - # print(privatekeyfordb) - # status.bchain_privatekey = privatekeyfordb - # status.save() print("blockchain_obj.publicKey",blockchain_obj.publicKey) print("blockchain_obj.privateKey",blockchain_obj.privateKey) if status.status == "SUCCESS": - msg.delete() file_to_audit = File.objects.get( script=script_id, type="script-csv" @@ -188,7 +187,6 @@ def run_audit(msg): ) script_docx = {} script_path1 = file_to_audit_docx.file.path - script_size = file_to_audit_docx.file.size with open(script_path1, 'rb') as _file: hash2 = uploadDataToIPFSNode(_file) script_docx["script_file_path"] = script_path1 @@ -293,30 +291,16 @@ def run_audit(msg): with open(audit_report_path, 'rb') as file1: hash2 = uploadDataToIPFSNode(file1) audit_report["script_file"] = hash2 - script_csv["script_file_path"] = audit_report_path - script_csv["type"] = "audit-report" + audit_report["script_file_path"] = audit_report_path + audit_report["type"] = "audit-report" audit_data["script-csv"]= script_csv audit_data["audit-report"]= audit_report - with open("/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/Blockchain2/file_stroge.txt","a") as file01: - file01.write("audit userkey------------------SUCCESS1\n") - file01.write(str(audit_data) + "\n") + Response,gasprice = UploadScriptAuditData(OWNER_KEY,blockchain_obj.publicKey,blockchain_obj.user_id,script_id,str(audit_data)) print("tx_hash",Response) - with open("/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/Blockchain2/file_stroge.txt","a") as file01: - file01.write("audit userkey------------------SUCCESS\n"+str(Response)) transactioni_id = str(Response) - # with open("/home/mnfbeta/mnf/app/Blockchain2/file_stroge.txt","a") as file01: - # file01.write(f"Transaction hash for audit is {str(transactioni_id)}\n") - # current_time = datetime.now() - # formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S") - # file01.write(f"Transaction hash for audit is {str(type(transactioni_id))}\n") - # file01.write(f" time for the above transaction id {str(formatted_time)}\n") - # audit_model_obj = ScriptAuditModel.objects.get( - # script = Script.objects.get(id = script_id)) status.transaction_hash =str(transactioni_id) - # audit_model_obj.transaction_hash = str(transactioni_id) - # audit_model_obj.save() status.save() # user_infos = user_info(tx_hash=Response,service="Script Audit",gas_fee=gasprice) @@ -360,13 +344,12 @@ def run_audit(msg): print(f"Folder '{folder2_path}' and its contents deleted successfully.") else: print(f"Folder '{folder2_path}' does not exist.") - # return JsonResponse(data, status=200) + return JsonResponse(data, status=200) # return Response("Success", status=200) else: - with open("/home/mnftaj/mnf_march22/MNF/app/Blockchain2/file_stroge.txt","a") as file01: - file01.write("audit userkey------------------else\n") + Response = UploadScriptAuditData(OWNER_KEY,blockchain_obj.publicKey,blockchain_obj.user_id,script_id,str(audit_data)) print("tx_hash",Response) hash = hash_decrypation(hash) @@ -387,7 +370,6 @@ def run_audit(msg): print("::::::::::::::",key_value) print("userkey = ", userkey) - # sendmail(to_email=to_email , email_code=email_code,key_value=key_value,filePath=certificate) diff --git a/kitchen_counter/conversion/translation/external_conversion.py b/kitchen_counter/conversion/translation/external_conversion.py index dfed378..95e4435 100644 --- a/kitchen_counter/conversion/translation/external_conversion.py +++ b/kitchen_counter/conversion/translation/external_conversion.py @@ -577,7 +577,7 @@ class Conversion: "private key": userkey.decode('utf-8'), "Transaction Hash": tx_id } - sendmail(to_email=to_email, email_code=email_code, key_value=key_value, filePath=certificatepath) + sendmail(to_email=to_email, email_code=email_code,key_value=key_value, filePath=certificatepath) except Exception as e: print("Error in blockchain is", e) diff --git a/kitchen_counter/scriptAudit/templates/audit/audit_AWS_home.html b/kitchen_counter/scriptAudit/templates/audit/audit_AWS_home.html new file mode 100755 index 0000000..f626a10 --- /dev/null +++ b/kitchen_counter/scriptAudit/templates/audit/audit_AWS_home.html @@ -0,0 +1,219 @@ +{% extends "mnfapp/base.html" %} +{% load static %} +{% load i18n %} + + + + {% block content %} + + + + + + + +
+
+
+
+

+ {% trans "We are processing your script. We will notify you when it is Audited." %} +

+
+
+
+
+
+ +
+ +

Welcome to Script Audit !

+
+
    +
  • Screenplay is a technical document!
  • +
  • It is required to be written precisely as per international conventions regarding font + type and size, + indentation, alignment and spaces. +
  • +
  • However, inadvertent human errors may creep in while writing it.
  • +
  • The Script audit identifies such inadvertent errors and corrects them.
  • +
  • It's simple. Upload your Script, wait a little and get the audited version.
  • +
+
+
+
+ Auditblockchainimgage +

Your Scripts are Secured by blockchain. MNF + has no access to Them.

+
+ http://1.6.141.104/audit/counter_run +

Upload on Blockchain and Audit your Screenplay !

+ {% comment %}
+ {% csrf_token %} {% endcomment %} + + {% if form.non_field_errors %} +
+ {% for error in form.non_field_errors %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ +
+ {% for field in form %} +
+ {% if field.errors %} +

{{ field.errors.0 }}

+ {% endif %} +
+ {% endfor %} +
+

Please upload your script in ”fdx” "docx", "pdf" or "txt" format only..

+
+
+
+ +
+

+
+ {% comment %}
{% endcomment %} +
+ + + + + + + + + + + + +{% endblock %} \ No newline at end of file diff --git a/smtp.py b/smtp.py new file mode 100644 index 0000000..c8bd3e1 --- /dev/null +++ b/smtp.py @@ -0,0 +1,162 @@ +"""SMTP email backend class.""" + +import smtplib +import ssl +import threading + +from django.conf import settings +from django.core.mail.backends.base import BaseEmailBackend +from django.core.mail.message import sanitize_address +from django.core.mail.utils import DNS_NAME +from django.utils.functional import cached_property + + +class EmailBackend(BaseEmailBackend): + """ + A wrapper that manages the SMTP network connection. + """ + + def __init__( + self, + host=None, + port=None, + username=None, + password=None, + use_tls=None, + fail_silently=False, + use_ssl=None, + timeout=None, + ssl_keyfile=None, + ssl_certfile=None, + **kwargs, + ): + super().__init__(fail_silently=fail_silently) + self.host = host or settings.EMAIL_HOST + self.port = port or settings.EMAIL_PORT + self.username = settings.EMAIL_HOST_USER if username is None else username + self.password = settings.EMAIL_HOST_PASSWORD if password is None else password + self.use_tls = settings.EMAIL_USE_TLS if use_tls is None else use_tls + self.use_ssl = settings.EMAIL_USE_SSL if use_ssl is None else use_ssl + self.timeout = settings.EMAIL_TIMEOUT if timeout is None else timeout + self.ssl_keyfile = ( + settings.EMAIL_SSL_KEYFILE if ssl_keyfile is None else ssl_keyfile + ) + self.ssl_certfile = ( + settings.EMAIL_SSL_CERTFILE if ssl_certfile is None else ssl_certfile + ) + if self.use_ssl and self.use_tls: + raise ValueError( + "EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive, so only set " + "one of those settings to True." + ) + self.connection = None + self._lock = threading.RLock() + + @property + def connection_class(self): + return smtplib.SMTP_SSL if self.use_ssl else smtplib.SMTP + + @cached_property + def ssl_context(self): + if self.ssl_certfile or self.ssl_keyfile: + ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT) + ssl_context.load_cert_chain(self.ssl_certfile, self.ssl_keyfile) + return ssl_context + else: + return ssl.create_default_context() + + def open(self): + """ + Ensure an open connection to the email server. Return whether or not a + new connection was required (True or False) or None if an exception + passed silently. + """ + if self.connection: + # Nothing to do if the connection is already open. + return False + + # If local_hostname is not specified, socket.getfqdn() gets used. + # For performance, we use the cached FQDN for local_hostname. + connection_params = {"local_hostname": DNS_NAME.get_fqdn()} + if self.timeout is not None: + connection_params["timeout"] = self.timeout + if self.use_ssl: + connection_params["context"] = self.ssl_context + try: + self.connection = self.connection_class( + self.host, self.port, **connection_params + ) + + # TLS/SSL are mutually exclusive, so only attempt TLS over + # non-secure connections. + if not self.use_ssl and self.use_tls: + self.connection.starttls(context=self.ssl_context) + if self.username and self.password: + self.connection.login(self.username, self.password) + return True + except OSError: + if not self.fail_silently: + raise + + def close(self): + """Close the connection to the email server.""" + if self.connection is None: + return + try: + try: + self.connection.quit() + except (ssl.SSLError, smtplib.SMTPServerDisconnected): + # This happens when calling quit() on a TLS connection + # sometimes, or when the connection was already disconnected + # by the server. + self.connection.close() + except smtplib.SMTPException: + if self.fail_silently: + return + raise + finally: + self.connection = None + + def send_messages(self, email_messages): + """ + Send one or more EmailMessage objects and return the number of email + messages sent. + """ + if not email_messages: + return 0 + with self._lock: + new_conn_created = self.open() + if not self.connection or new_conn_created is None: + # We failed silently on open(). + # Trying to send would be pointless. + return 0 + num_sent = 0 + try: + for message in email_messages: + sent = self._send(message) + if sent: + num_sent += 1 + finally: + if new_conn_created: + self.close() + return num_sent + + def _send(self, email_message): + """A helper method that does the actual sending.""" + if not email_message.recipients(): + return False + encoding = email_message.encoding or settings.DEFAULT_CHARSET + from_email = sanitize_address(email_message.from_email, encoding) + recipients = [ + sanitize_address(addr, encoding) for addr in email_message.recipients() + ] + message = email_message.message() + try: + self.connection.sendmail( + from_email, recipients, message.as_bytes(linesep="\r\n") + ) + except smtplib.SMTPException: + if not self.fail_silently: + raise + return False + return True \ No newline at end of file