latest audit, conversion and auto email changes

This commit is contained in:
Ubuntu 2024-05-08 12:46:12 +00:00
parent be47c15dc4
commit 13b31e49aa
109 changed files with 785 additions and 2433 deletions

View File

@ -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)

View File

@ -1,5 +0,0 @@
from django.apps import AppConfig
class AutoEmailConfig(AppConfig):
name = 'auto_email'

Binary file not shown.

Binary file not shown.

View File

@ -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)),
],
),
]

View File

@ -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)

View File

@ -1,7 +0,0 @@
from .models import *
from rest_framework import serializers
class Mnf_NotificationSerializer(serializers.ModelSerializer):
class Meta:
model = Mnf_Notification
fields = '__all__'

View File

@ -1,7 +0,0 @@
from .models import *
from rest_framework import serializers
class Mnf_NotificationSerializer(serializers.ModelSerializer):
class Meta:
model = Mnf_Notification
fields = '__all__'

View File

@ -1,51 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Template</title>
<style>
@import url("https://fonts.googleapis.com/css2?family=Lato&family=Poppins:wght@100;300;400;500;600;700;800&display=swap");
article { color: #616161; line-height: 18px; }
article b { color: #252525; }
</style>
</head>
<body style="margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif;font-size: 16px;">
<div style="max-width: 70vw; box-shadow: 0px 4px 27px 0px #00000040; margin: 16px auto;">
<img src="https://uidemos.s3.ap-south-1.amazonaws.com/v2_512.png" style="width: 100%;">
<!-- <h1 style="font-size: 18px; font-weight: 700; text-align: center; margin: auto; color: #33B0CA;">CONGRATULATIONS! <br>Your Premise is now live!!!</h1> -->
<h1 style="font-size: 1.25em; font-weight: 800; text-align: center; margin: auto; color: #33B0CA;"><b>{{title1}}</b></h1>
<h2 style="font-size: 1.25em; font-weight: 800; text-align: center; margin: auto; color: #33B0CA;"><b>{{title2}}<br></b></h2>
<div style="padding: 28px">
<div style="text-align: center;">
<img src="{{doodleurl}}" style="width: 235px; height: 245px;">
</div>
<article>
<!-- <h2 style="font-size: 16px; font-weight: 500; color: #252525; margin-bottom: 16px;">Dear {{User}},</h2>
<p style="font-size: 14px; font-weight: 400; color: #616161; margin-bottom: 16px;">CONGRATULATIONS! We are thrilled to welcome you to MNF, your gateway to a smoother sail on your filmmaking journey.</p>
<p style="font-size: 14px; font-weight: 400; color: #616161; margin-bottom: 16px;">Thank you for choosing us. By signing up, you've taken the first step towards the world of filmmaking made easy with AI. Your journey with MNF starts here, and we promise to make every moment worthwhile.</p>
<p style="font-size: 14px; font-weight: 400; color: #616161; margin-bottom: 16px;">Explore our features, connect with the community, and unlock a plethora of benefits tailored just for you.</p>
<p style="font-size: 14px; font-weight: 400; color: #616161; margin-bottom: 16px;">Should you have any questions or need assistance, our support team is ready to help. Feel free to reach out at any time.</p>
<p style="font-size: 14px; font-weight: 400; color: #616161; margin-bottom: 16px;">Get ready for an amazing ride with MNF!</p>
<h2 style="font-size: 16px; font-weight: 500;">Thanks and Regards <br>Team MyNextFilm</h2> -->
{% load custom_filters %}
{% with pattern="\[(.*?)\]\((.*?)\)" %}
{% with modified_value=invitation|urlize_text|safe %}
<p>{{ modified_value|safe }}</p>
{% endwith %}
{% with modified_value=additional|urlize_text|safe %}
<p>{{ modified_value|safe }}</p>
{% endwith %}
{% endwith %}
</article>
</div>
<!-- <p style="font-size: 14px; font-weight: 400; color: #616161; padding: 0 28px;">Got an amazing Premise? <a href="https://mynextfilm.ai/ideamall/#/premise-pool">Share it in the premise pool!!!</a></p> -->
<div style="text-align: center; margin-bottom: 24px;">
<img src="{{poster}}" style="border-radius: 8px; width: 90%;">
</div>
<footer style="font-size: 16px; font-weight: 500; color: #FAFAFA; background: #33B0CA; text-align: center; padding: 12px 0;">
For any related queries, please reach out to .<a href="mailto:support@mynextfilm.ai" target="_blank" style="font-weight: 700; text-decoration: underline; color: #FAFAFA;">"MY NEXT FILM PRIVATE LIMITED".</a><span style="opacity:0.05; display: inline-block;">{{emailcode}}<span>
</footer>
</div>
</body>
</html>

View File

@ -1,134 +0,0 @@
<style>
body,
table,
td,
a {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
table,
td {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
img {
-ms-interpolation-mode: bicubic;
}
img {
border: 0;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
}
table {
border-collapse: collapse !important;
}
body {
height: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
}
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
div[style*="margin: 16px 0;"] {
margin: 0 !important;
}
</style>
<body style="background-color: #f7f5fa; margin: 0 !important; padding: 0 !important;">
{% block message %}
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td bgcolor="#33B0CA" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="480">
<tr>
<td align="center" valign="top" style="padding: 40px 10px 20px 10px;">
<div style="display: block; font-family: Helvetica, Arial, sans-serif; color: #ffffff; font-size: 25px;"border="0"><b>My Next Film</b></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#33B0CA" align="center" style="padding: 0px 10px 0px 10px;">
<table border="0" cellpadding="5" cellspacing="0" width="480" style="width: 60%">
<tr>
<td bgcolor="#ffffff" align="center" valign="top" style="border-radius:4px 4px 0px 0px; color: #111111; font-family: Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; line-height: 48px;">
<h1 style="font-size: 25px; font-weight: 400;font-family: Helvetica, Arial, sans-serif; margin: 0; color: #ee3c4d;"><b>{{title1}}</b></h1>
<h2 style="font-size: 22px; font-weight: 400;font-family: Helvetica, Arial, sans-serif; margin: 0; color: #ee3c4d;"><b>{{title2}}<br></b></h2>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0" width="480" style="width: 60%">
<tr>
<td bgcolor="#ffffff" align="left">
<table width="100%" border="0" cellspacing="10" cellpadding="1" padding:"5px">
<tr>
<td style="padding:20px;">
{% load custom_filters %}
{% with pattern="\[(.*?)\]\((.*?)\)" %}
{% with modified_value=invitation|urlize_text|safe %}
<p>{{ modified_value|safe }}</p>
{% endwith %}
{% with modified_value=additional|urlize_text|safe %}
<p>{{ modified_value|safe }}</p>
{% endwith %}
{% endwith %}
<br>
<br>
<a href="{{pageurl}}"><img src="{{poster}}" alt="{{poster}}" style="max-width:100%;height:auto;" ></a>
<br>
<br>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center"
style="padding: 30px 30px 30px 30px; border-top:1px solid #dddddd;">
<table border="0" cellspacing="0" cellpadding="0" style= "margin-top:-25px">
<tr>
<td bgcolor="" align="left"
style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;">
<p style="margin: 0;">For any related queries, please reach out to ."<a href="mailto:support@mynextfilm.ai" target="_blank"
style="color: #111111; font-weight: 700;">MY NEXT FILM PRIVATE LIMITED<a>".</p><div style="opacity:0.05">{{emailcode}}<div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endblock message %}
</body>

View File

@ -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'<a href="\2">\1</a>', value))

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,13 +0,0 @@
from django.urls import path,include
from . import views
urlpatterns = [
path('mnfnotification/', views.mnf_notification, name="mnfnotification"),
path('mnfnotification/<str:pk>/', views.mnf_notification, name="mnfnotification"),
]

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -25,17 +25,15 @@ def UploadConversionData(privatekey,pubkey, user_id,project,data):
print("private Key",privatekey) print("private Key",privatekey)
acc1 = web3.eth.account.from_key(privatekey).address acc1 = web3.eth.account.from_key(privatekey).address
nonce = web3.eth.get_transaction_count(acc1) nonce = web3.eth.get_transaction_count(acc1)
gas_price = web3.eth.gas_price
uploadData = contractInst.functions.UploadConversionData(pubkey,user_id,project,data).build_transaction({ uploadData = contractInst.functions.UploadConversionData(pubkey,user_id,project,data).build_transaction({
'gasPrice': web3.eth.gas_price, 'chainId': CHAIN_ID, '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) signed_transaction = web3.eth.account.sign_transaction(uploadData, private_key=privatekey)
transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction)
print("transaction hash",transaction_hash) print("transaction hash",transaction_hash)
transaction_receipt = web3.eth.wait_for_transaction_receipt(transaction_hash) transaction_receipt = web3.eth.wait_for_transaction_receipt(transaction_hash)
gas_used = transaction_receipt['gasUsed'] trancation_fee = transaction_receipt.effectiveGasPrice*transaction_receipt.gasUsed
trancation_fee = gas_used*gas_price
tx_id = transaction_hash.hex() tx_id = transaction_hash.hex()
return tx_id,trancation_fee return tx_id,str(trancation_fee)
except Exception as e: except Exception as e:
print({"error":str(e)}) print({"error":str(e)})
return e return e

Binary file not shown.

View File

@ -11,7 +11,7 @@ class user_info:
def update_info(self,request): def update_info(self,request):
obj= BlockchainUserInfo() 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) associated_corporate_users = CorporateUser.objects.get(user=request.user)
obj.coprate_user = associated_corporate_users obj.coprate_user = associated_corporate_users
obj.user = request.user obj.user = request.user
@ -73,4 +73,4 @@ class CorporateUserInfo:
) )
return list(blockchain_info) return list(blockchain_info)
except CorporateUser.DoesNotExist: except CorporateUser.DoesNotExist:
return None return None

View File

@ -75,7 +75,7 @@ def decryptionOflocalUrl(hash):
print(":::::::::::::::::::::",video_url) print(":::::::::::::::::::::",video_url)
return video_url return video_url
except: except:
return "http://127.0.0.1:8000/ipfs/QmZKWBEKQ28UixqGec6Qz9fEPsJktarzC8NSoFjJ1bgUQo" return f"{DOWNLOAD_URL}/QmZKWBEKQ28UixqGec6Qz9fEPsJktarzC8NSoFjJ1bgUQo"
def convertHexToBinary(binary): def convertHexToBinary(binary):
hextobainary = bytes.fromhex(binary) hextobainary = bytes.fromhex(binary)
return hextobainary return hextobainary

View File

@ -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 <class 'str'>
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 <class 'str'>
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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7efd75e682d0>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7efd76667d10>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7efd77220390>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7efd766bfe10>: Failed to establish a new connection: [Errno 111] Connection refused'))"}}
Transaction hash for audit is 0x8a0e83e00944e784eb700e8835a592f3f9f016729b45b2a65bdfce01bc05ccdf
Transaction hash for audit is <class 'str'>
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 <class 'str'>
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 <class 'str'>
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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f3d3a272bd0>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f3d6031c1d0>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f3da0169d10>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f3db86868d0>: Failed to establish a new connection: [Errno 111] Connection refused'))"}}
Transaction hash for audit is 0x0c54acc739451a995ab2c7dd3c07c6411ee43c2754c74ffd37bec81f31d78d8d
Transaction hash for audit is <class 'str'>
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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f57ea6dd090>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f57cba28290>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f57d5d15150>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f57cba28ed0>: Failed to establish a new connection: [Errno 111] Connection refused'))"}}
Transaction hash for audit is 0x1c59ce60499a996fef3a1d48d1e595159f915d6d0698b31b03d447ea33669d03
Transaction hash for audit is <class 'str'>
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 <class 'str'>
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 <class 'str'>
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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f607d441510>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f5ec279bed0>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f5ec27f4c90>: 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('<ipfshttpclient.requests_wrapper.HTTPConnection object at 0x7f607d3bded0>: Failed to establish a new connection: [Errno 111] Connection refused'))"}}
Transaction hash for audit is 0xa9a11f33bf4658625d2ec906b4f5d30ac2ff63a60cac64ebaad188909ed7bf6b
Transaction hash for audit is <class 'str'>
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 <class 'str'>
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 <class 'str'>
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

View File

@ -1,14 +1,21 @@
from web3 import Web3 from web3 import Web3
import time 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 # mainnet
# CAddress = '0x3a5d033CdF38aC4a9fe116CE88EBA2E93260044c' # 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" } ]' # 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' CAddress =CONTRACT_ADDRESS
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" } ]' abi = ABI
contractInst = web3.eth.contract(address=CAddress, abi=abi) contractInst = web3.eth.contract(address=CAddress, abi=abi)
def UploadScriptAuditData(privatekey,pubkey,user_id,project,data): 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 acc1 = web3.eth.account.from_key(privatekey).address
nonce = web3.eth.get_transaction_count(acc1) nonce = web3.eth.get_transaction_count(acc1)
uploadData = contractInst.functions.UploadScriptAuditData(pubkey,user_id,project,data).build_transaction({ 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) signed_transaction = web3.eth.account.sign_transaction(uploadData, private_key=privatekey)
transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction)
print("transaction hash",transaction_hash) print("transaction hash",transaction_hash)
transaction_receipt = web3.eth.wait_for_transaction_receipt(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() tx_id = transaction_hash.hex()
return tx_id return tx_id,str(trancation_fee)
except Exception as e: except Exception as e:
# print({"error":str(e)}) # print({"error":str(e)})
return e return e
@ -50,7 +58,7 @@ def deleteScriptAudit(privatekey,user_id,project):
acc1 = web3.eth.account.from_key(privatekey).address acc1 = web3.eth.account.from_key(privatekey).address
nonce = web3.eth.getTransactionCount(acc1) nonce = web3.eth.getTransactionCount(acc1)
deleteData = contractInst.functions.deleteScriptAudit(user_id,project).buildTransaction({ 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) signed_transaction = web3.eth.account.sign_transaction(deleteData, private_key=privatekey)
transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction)
transaction_receipt = web3.eth.wait_for_transaction_receipt(transaction_hash) 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)}) print({"PPT_conversion_delete_error":str(e)})
# UploadScriptAuditData("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",1,'1752aa50-a751-4149-84ad-680dcb932972',"fhdsjkdfd") # UploadScriptAuditData("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",1,'1752aa50-a751-4149-84ad-680dcb932972',"fhdsjkdfd")
# getScriptAudit("6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad",2,'1752aa50-a751-4149-84ad-680dcb932972') # 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')

View File

@ -25,8 +25,9 @@ def UploadScriptPadData(privatekey,pubkey,user_id,project,data):
transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction) transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction)
print("transaction hash",transaction_hash) print("transaction hash",transaction_hash)
transaction_receipt = web3.eth.wait_for_transaction_receipt(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() tx_id = transaction_hash.hex()
return tx_id return tx_id,str(trancation_fee)
except Exception as e: except Exception as e:
# print({"error":str(e)}) # print({"error":str(e)})
return e return e

Some files were not shown because too many files have changed in this diff Show More