Ninad077 commited on
Commit
8ac32ba
Β·
verified Β·
1 Parent(s): 5a2e857

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +6 -1
  2. mid.py +513 -0
  3. query_mid.py +15 -0
app.py CHANGED
@@ -64,7 +64,8 @@ menu_options = [
64
  {"label": "Recon checking", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"},
65
  {"label": "Manual BQ upload", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"},
66
  {"label": "Invoice splitter", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"},
67
- {"label": "Seller sale validation", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"}
 
68
  ]
69
 
70
  # Create the custom option menu
@@ -403,5 +404,9 @@ elif selected_option == "Seller sale validation":
403
  with open('seller.py') as file:
404
  exec(file.read())
405
 
 
 
 
 
406
 
407
 
 
64
  {"label": "Recon checking", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"},
65
  {"label": "Manual BQ upload", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"},
66
  {"label": "Invoice splitter", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"},
67
+ {"label": "Seller sale validation", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"},
68
+ {"label": "MID checker", "icon": "πŸ“Š", "description": "Schedule an email with BigQuery data"}
69
  ]
70
 
71
  # Create the custom option menu
 
404
  with open('seller.py') as file:
405
  exec(file.read())
406
 
407
+ elif selected_option == "MID checker":
408
+ with open('mid.py') as file:
409
+ exec(file.read())
410
+
411
 
412
 
mid.py ADDED
@@ -0,0 +1,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from google.cloud import bigquery
2
+ from google.oauth2 import service_account
3
+ import streamlit as st
4
+ import json
5
+ import datetime
6
+ import imaplib
7
+ import email
8
+ import pandas as pd
9
+ import os
10
+ from query_mid import queries
11
+ import html
12
+ from ap import Webhook_urls
13
+ import requests
14
+
15
+ # Hardcoded email credentials (consider securing these in the backend instead of in the script)
16
+ EMAIL_USERNAME = "[email protected]"
17
+ EMAIL_PASSWORD = "etdv kmvs qbsi zose"
18
+
19
+ # Ensure a directory exists for storing attachments
20
+ ATTACHMENTS_DIR = "attachments"
21
+ os.makedirs(ATTACHMENTS_DIR, exist_ok=True)
22
+
23
+ # Custom button styles
24
+ button_styles = """
25
+ <style>
26
+ .download-button {
27
+ color: #ffffff;
28
+ font-size: 20px;
29
+ background-image: linear-gradient(to right, #800000, #ff0000);
30
+ border: none;
31
+ padding: 10px 20px;
32
+ cursor: pointer;
33
+ border-radius: 15px;
34
+ display: inline-block;
35
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 8px 15px rgba(0, 0, 0, 0.1);
36
+ transition: all 0.3s ease;
37
+ }
38
+ .download-button:hover {
39
+ background-color: #00ff00;
40
+ color: #ff0000;
41
+ box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2), 0 12px 20px rgba(0, 0, 0, 0.2);
42
+ }
43
+ .email-container {
44
+ background-color: #ffffff; /* Shiny white */
45
+ padding: 20px; /* Inner padding */
46
+ border-radius: 15px; /* Rounded corners */
47
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 3D effect */
48
+ margin: 10px 0; /* Margin between containers */
49
+ font-size: 20px; /* Font size for text */
50
+ color: #800000; /* Font color */
51
+ font-family: 'Arial', sans-serif; /* Font family */
52
+ position: relative; /* For 3D effect */
53
+ z-index: 1; /* Ensure it's above the background */
54
+ }
55
+ .email-container::before {
56
+ content: '';
57
+ position: absolute;
58
+ top: 0;
59
+ left: 0;
60
+ right: 0;
61
+ bottom: 0;
62
+ border-radius: 15px; /* Match the container's border radius */
63
+ background: rgba(255, 255, 255, 0.1); /* Light overlay for effect */
64
+ z-index: -1; /* Position behind the text */
65
+ filter: blur(10px); /* Soft blur for 3D effect */
66
+ }
67
+ </style>
68
+ """
69
+
70
+ st.markdown(button_styles, unsafe_allow_html=True)
71
+
72
+ # Function to fetch filtered emails from today's date and download attachments
73
+ def fetch_filtered_today_emails():
74
+ today = datetime.date.today()
75
+ emails_data = []
76
+ try:
77
+ mail = imaplib.IMAP4_SSL("imap.gmail.com")
78
+ mail.login(EMAIL_USERNAME, EMAIL_PASSWORD)
79
+ mail.select("inbox")
80
+ status, response = mail.search(None, f'(SENTON "{today.strftime("%d-%b-%Y")}")')
81
+ email_ids = response[0].split()
82
+
83
+ for email_id in email_ids:
84
+ status, msg_data = mail.fetch(email_id, "(RFC822)")
85
+ if status == "OK":
86
+ msg = email.message_from_bytes(msg_data[0][1])
87
+ if ("Razorpay Reports" in msg["From"] and "Combined_Report_" in msg["Subject"]):
88
+ email_details = {
89
+ "Message ID": msg["Message-ID"],
90
+ "Created at": msg["Date"],
91
+ "From": msg["From"],
92
+ "To": msg["To"],
93
+ "Subject": msg["Subject"],
94
+ "SPF": "PASS",
95
+ "DKIM": "PASS",
96
+ "DMARC": "PASS",
97
+ "Attachments": []
98
+ }
99
+ for part in msg.walk():
100
+ if part.get_content_disposition() == "attachment":
101
+ filename = part.get_filename()
102
+ if filename:
103
+ file_path = os.path.join(ATTACHMENTS_DIR, filename)
104
+ with open(file_path, "wb") as f:
105
+ f.write(part.get_payload(decode=True))
106
+ email_details["Attachments"].append((file_path, filename))
107
+
108
+ emails_data.append(email_details)
109
+
110
+ mail.logout()
111
+ except Exception as e:
112
+ st.error(f"Failed to retrieve emails: {e}")
113
+
114
+ return emails_data
115
+
116
+ # BigQuery Query and Duplicate Check Function
117
+ def check_duplicates(credentials_file):
118
+ results = {}
119
+ credentials = service_account.Credentials.from_service_account_info(json.loads(credentials_file))
120
+ client = bigquery.Client(credentials=credentials, project=credentials.project_id)
121
+
122
+ mids_from_bq = set()
123
+ query_record_count = 0 # Initialize record count
124
+
125
+ for query_name, query in queries.items():
126
+ query_job = client.query(query)
127
+ df = query_job.result().to_dataframe()
128
+ count = len(df)
129
+ query_record_count += count # Update total record count
130
+
131
+ if 'Subject_date' in df.columns:
132
+ df['Subject_date'] = pd.to_datetime(df['Subject_date']).dt.date
133
+ mids_from_bq.update(df['MID'].unique()) # Assuming 'MID' is the column name in your BigQuery results
134
+ results[query_name] = df
135
+
136
+ html_subject = """
137
+ <html>
138
+ <head>
139
+ <style>
140
+ .button {
141
+ display: inline-block;
142
+ padding: 10px 20px;
143
+ border-radius: 12px;
144
+ background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
145
+ box-shadow:
146
+ 0 6px 12px rgba(0, 0, 0, 0.3),
147
+ 0 8px 16px rgba(0, 0, 0, 0.2),
148
+ inset 0 -2px 4px rgba(255, 255, 255, 0.6);
149
+ text-align: center;
150
+ position: relative;
151
+ transform: translateY(4px);
152
+ transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
153
+ cursor: pointer;
154
+ user-select: none;
155
+ }
156
+ .button:hover {
157
+ box-shadow:
158
+ 0 8px 16px rgba(0, 0, 0, 0.3),
159
+ 0 12px 24px rgba(0, 0, 0, 0.2);
160
+ transform: translateY(2px);
161
+ }
162
+ .button:active {
163
+ box-shadow:
164
+ 0 4px 8px rgba(0, 0, 0, 0.3),
165
+ 0 6px 12px rgba(0, 0, 0, 0.2);
166
+ transform: translateY(0);
167
+ }
168
+ </style>
169
+ </head>
170
+ <body>
171
+ <div class="button">
172
+ <h3 style="
173
+ font-size: 20px;
174
+ color: #ffffff;
175
+ background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
176
+ background-clip: text;
177
+ -webkit-background-clip: text;
178
+ text-fill-color: transparent;
179
+ -webkit-text-fill-color: transparent;
180
+ margin: 0;
181
+ text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
182
+ ">MID query results:</h3>
183
+ </div>
184
+ </body>
185
+ </html>
186
+ """
187
+
188
+
189
+ st.markdown(html_subject, unsafe_allow_html=True)
190
+ st.write("")
191
+ st.write("")
192
+ st.dataframe(df)
193
+
194
+ return results, mids_from_bq, query_record_count # Return the total count
195
+
196
+ def send_message_via_webhook(message, webhook_url):
197
+ """Send a message to a Slack channel via webhook."""
198
+ response = requests.post(webhook_url, json={"text": message})
199
+
200
+ if response.status_code != 200:
201
+ return False, f"Request to Slack returned an error {response.status_code}, the response is:\n{response.text}"
202
+
203
+ return True, "Message sent successfully."
204
+
205
+
206
+ # Dropdown for selecting webhook URL
207
+ html_subject = """
208
+ <html>
209
+ <head>
210
+ <style>
211
+ .button {
212
+ display: inline-block;
213
+ padding: 10px 20px;
214
+ border-radius: 12px;
215
+ background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
216
+ box-shadow:
217
+ 0 6px 12px rgba(0, 0, 0, 0.3),
218
+ 0 8px 16px rgba(0, 0, 0, 0.2),
219
+ inset 0 -2px 4px rgba(255, 255, 255, 0.6);
220
+ text-align: center;
221
+ position: relative;
222
+ transform: translateY(4px);
223
+ transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
224
+ cursor: pointer;
225
+ user-select: none;
226
+ }
227
+ .button:hover {
228
+ box-shadow:
229
+ 0 8px 16px rgba(0, 0, 0, 0.3),
230
+ 0 12px 24px rgba(0, 0, 0, 0.2);
231
+ transform: translateY(2px);
232
+ }
233
+ .button:active {
234
+ box-shadow:
235
+ 0 4px 8px rgba(0, 0, 0, 0.3),
236
+ 0 6px 12px rgba(0, 0, 0, 0.2);
237
+ transform: translateY(0);
238
+ }
239
+ </style>
240
+ </head>
241
+ <body>
242
+ <div class="button">
243
+ <h3 style="
244
+ font-size: 20px;
245
+ color: #ffffff;
246
+ background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
247
+ background-clip: text;
248
+ -webkit-background-clip: text;
249
+ text-fill-color: transparent;
250
+ -webkit-text-fill-color: transparent;
251
+ margin: 0;
252
+ text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
253
+ ">Select the channel/member</h3>
254
+ </div>
255
+ </body>
256
+ </html>
257
+ """
258
+
259
+
260
+ st.markdown(html_subject, unsafe_allow_html=True)
261
+ selected_webhook_name = st.selectbox("", [""] + list(Webhook_urls.keys()))
262
+ selected_webhook_url = Webhook_urls[selected_webhook_name] if selected_webhook_name else None
263
+
264
+ # Get credentials for BigQuery access
265
+ # Upload credentials file
266
+ html_subject = """
267
+ <html>
268
+ <head>
269
+ <style>
270
+ .button {
271
+ display: inline-block;
272
+ padding: 10px 20px;
273
+ border-radius: 12px;
274
+ background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
275
+ box-shadow:
276
+ 0 6px 12px rgba(0, 0, 0, 0.3),
277
+ 0 8px 16px rgba(0, 0, 0, 0.2),
278
+ inset 0 -2px 4px rgba(255, 255, 255, 0.6);
279
+ text-align: center;
280
+ position: relative;
281
+ transform: translateY(4px);
282
+ transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
283
+ cursor: pointer;
284
+ user-select: none;
285
+ }
286
+ .button:hover {
287
+ box-shadow:
288
+ 0 8px 16px rgba(0, 0, 0, 0.3),
289
+ 0 12px 24px rgba(0, 0, 0, 0.2);
290
+ transform: translateY(2px);
291
+ }
292
+ .button:active {
293
+ box-shadow:
294
+ 0 4px 8px rgba(0, 0, 0, 0.3),
295
+ 0 6px 12px rgba(0, 0, 0, 0.2);
296
+ transform: translateY(0);
297
+ }
298
+ </style>
299
+ </head>
300
+ <body>
301
+ <div class="button">
302
+ <h3 style="
303
+ font-size: 20px;
304
+ color: #ffffff;
305
+ background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
306
+ background-clip: text;
307
+ -webkit-background-clip: text;
308
+ text-fill-color: transparent;
309
+ -webkit-text-fill-color: transparent;
310
+ margin: 0;
311
+ text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
312
+ ">Upload the JSON file</h3>
313
+ </div>
314
+ </body>
315
+ </html>
316
+ """
317
+
318
+
319
+ st.markdown(html_subject, unsafe_allow_html=True)
320
+ credentials_file = st.file_uploader("", type="json")
321
+
322
+ # Initialize filtered_emails and mids
323
+ filtered_emails = []
324
+ mids_from_emails = set()
325
+
326
+ if credentials_file:
327
+ credentials_data = credentials_file.read().decode("utf-8")
328
+ query_results, mids_from_bq, query_record_count = check_duplicates(credentials_data) # Capture the query count
329
+
330
+ # Retrieve today's filtered emails
331
+ filtered_emails = fetch_filtered_today_emails()
332
+
333
+ if filtered_emails:
334
+ html_subject = """
335
+ <html>
336
+ <head>
337
+ <style>
338
+ .button {
339
+ display: inline-block;
340
+ padding: 10px 20px;
341
+ border-radius: 12px;
342
+ background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
343
+ box-shadow:
344
+ 0 6px 12px rgba(0, 0, 0, 0.3),
345
+ 0 8px 16px rgba(0, 0, 0, 0.2),
346
+ inset 0 -2px 4px rgba(255, 255, 255, 0.6);
347
+ text-align: center;
348
+ position: relative;
349
+ transform: translateY(4px);
350
+ transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
351
+ cursor: pointer;
352
+ user-select: none;
353
+ }
354
+ .button:hover {
355
+ box-shadow:
356
+ 0 8px 16px rgba(0, 0, 0, 0.3),
357
+ 0 12px 24px rgba(0, 0, 0, 0.2);
358
+ transform: translateY(2px);
359
+ }
360
+ .button:active {
361
+ box-shadow:
362
+ 0 4px 8px rgba(0, 0, 0, 0.3),
363
+ 0 6px 12px rgba(0, 0, 0, 0.2);
364
+ transform: translateY(0);
365
+ }
366
+ </style>
367
+ </head>
368
+ <body>
369
+ <div class="button">
370
+ <h3 style="
371
+ font-size: 20px;
372
+ color: #ffffff;
373
+ background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
374
+ background-clip: text;
375
+ -webkit-background-clip: text;
376
+ text-fill-color: transparent;
377
+ -webkit-text-fill-color: transparent;
378
+ margin: 0;
379
+ text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
380
+ ">Emails generated from Razorpay accounts:</h3>
381
+ </div>
382
+ </body>
383
+ </html>
384
+ """
385
+
386
+
387
+ st.markdown(html_subject, unsafe_allow_html=True)
388
+ st.write("")
389
+ for email_detail in filtered_emails:
390
+ mids_from_emails.add(email_detail["Message ID"])
391
+ email_container = f"""
392
+ <div class="email-container">
393
+ <p><strong>Message ID:</strong> {html.escape(email_detail['Message ID'])}</p>
394
+ <p><strong>Created at:</strong> {html.escape(email_detail['Created at'])}</p>
395
+ <p><strong>From:</strong> <span>{html.escape(email_detail['From'].replace('@', '&#64;'))}</span></p>
396
+ <p><strong>To:</strong> <span>{html.escape(email_detail['To'].replace('@', '&#64;'))}</span></p>
397
+ <p><strong>Subject:</strong> {html.escape(email_detail['Subject'])}</p>
398
+ <p><strong>SPF:</strong> {html.escape(email_detail['SPF'])}</p>
399
+ <p><strong>DKIM:</strong> {html.escape(email_detail['DKIM'])}</p>
400
+ <p><strong>DMARC:</strong> {html.escape(email_detail['DMARC'])}</p>
401
+ </div>
402
+ """
403
+ st.markdown(email_container, unsafe_allow_html=True)
404
+
405
+ if email_detail["Attachments"]:
406
+ subheader_html = f"""
407
+ <div style="background-image: linear-gradient(to right, #800000, #ff0000);
408
+ -webkit-background-clip: text;
409
+ -webkit-text-fill-color: transparent;
410
+ margin: 10px 0;">
411
+ <h4 style="margin: 0; font-size: 20px;">Attachment:</h4> <!-- Change h2 to h4 -->
412
+ </div>
413
+ """
414
+
415
+ # Render the subheader
416
+ st.markdown(subheader_html, unsafe_allow_html=True)
417
+ for idx, (attachment_path, filename) in enumerate(email_detail["Attachments"]):
418
+ with open(attachment_path, "rb") as file:
419
+ file_data = file.read()
420
+ btn_id = f"download-button-{idx}-{filename}"
421
+ download_button = f"""
422
+ <a href="data:application/octet-stream;base64,{file_data.hex()}" download="{filename}">
423
+ <div class="download-button">{filename}</div>
424
+ </a>
425
+ """
426
+ st.markdown(download_button, unsafe_allow_html=True)
427
+ st.write("---")
428
+
429
+ else:
430
+ st.error("No matching emails found for today.")
431
+
432
+ # Check for mismatches
433
+ missing_mids = mids_from_bq.difference(mids_from_emails)
434
+
435
+ # Prepare the Slack message
436
+ total_records_in_email = len(filtered_emails)
437
+ mismatch_found = len(missing_mids) > 0
438
+
439
+ slack_message = (
440
+ f"Total Records in BigQuery: {query_record_count}\n"
441
+ f"Total Records in Email: {total_records_in_email}\n"
442
+ f"MID Mismatch: {'Yes' if mismatch_found else 'No'}"
443
+ )
444
+
445
+ # st.write(f"Total Records in BigQuery: {query_record_count}") # Show total records fetched
446
+ # st.write(f"Total Emails received from Razorpay: {total_records_in_email}")
447
+ # st.write(f"Missing MIDs: {', '.join(missing_mids) if missing_mids else 'None'}")
448
+
449
+ subheader_html = f"""
450
+ <div style="background-image: linear-gradient(to right, #800000, #ff0000);
451
+ -webkit-background-clip: text;
452
+ -webkit-text-fill-color: transparent;
453
+ margin: 10px 0;">
454
+ <h4 style="margin: 0; font-size: 20px;">Total records in MID query: {query_record_count}</h4> <!-- Change h2 to h4 -->
455
+ </div>
456
+ """
457
+
458
+ st.markdown(subheader_html, unsafe_allow_html=True)
459
+
460
+ subheader_html = f"""
461
+ <div style="background-image: linear-gradient(to right, #800000, #ff0000);
462
+ -webkit-background-clip: text;
463
+ -webkit-text-fill-color: transparent;
464
+ margin: 10px 0;">
465
+ <h4 style="margin: 0; font-size: 20px;">Total Emails recieved from Razorpay accounts: {total_records_in_email}</h4> <!-- Change h2 to h4 -->
466
+ </div>
467
+ """
468
+
469
+ st.markdown(subheader_html, unsafe_allow_html=True)
470
+
471
+
472
+ subheader_html = f"""
473
+ <div style="background-image: linear-gradient(to right, #800000, #ff0000);
474
+ -webkit-background-clip: text;
475
+ -webkit-text-fill-color: transparent;
476
+ margin: 10px 0;">
477
+ <h4 style="margin: 0; font-size: 20px;">Missing MIDs:{', '.join(missing_mids) if missing_mids else 'None'}</h4> <!-- Change h2 to h4 -->
478
+ </div>
479
+ """
480
+
481
+ st.markdown(subheader_html, unsafe_allow_html=True)
482
+
483
+
484
+
485
+ # Send message to Slack
486
+ button_styles = """
487
+ <style>
488
+ div.stButton > button {
489
+ color: #ffffff; /* Text color */
490
+ font-size: 30px;
491
+ background-image: linear-gradient(to right, #800000, #ff0000); /* Maroon to light red gradient */
492
+ border: none;
493
+ padding: 10px 20px;
494
+ cursor: pointer;
495
+ border-radius: 15px;
496
+ display: inline-block;
497
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 8px 15px rgba(0, 0, 0, 0.1); /* Box shadow */
498
+ transition: all 0.3s ease; /* Smooth transition on hover */
499
+ }
500
+ div.stButton > button:hover {
501
+ background-color: #00ff00; /* Hover background color */
502
+ color: #ff0000; /* Hover text color */
503
+ box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2), 0 12px 20px rgba(0, 0, 0, 0.2); /* Box shadow on hover */
504
+ }
505
+ </style>
506
+ """
507
+ st.markdown(button_styles, unsafe_allow_html=True)
508
+ if st.button("Send to Slack"):
509
+ success, response = send_message_via_webhook(slack_message, selected_webhook_url)
510
+ if success:
511
+ st.success(response)
512
+ else:
513
+ st.error(response)
query_mid.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # query_mid.py
2
+
3
+ queries = {
4
+ "query": """
5
+ SELECT
6
+ *
7
+ FROM
8
+ `fynd-db.finance_recon_tool_asia.COD_Email_Upload_Status`
9
+ WHERE
10
+ PARSE_DATE('%e-%b-%Y',Date) = CURRENT_DATE()
11
+ and label = "PG_Combine_report"
12
+ ORDER BY
13
+ PARSE_DATE('%e-%b-%Y',Date) asc
14
+ """
15
+ }