Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,14 +78,14 @@ def create_and_upload_pdf(dpr_content):
|
|
78 |
"Content-Type": "application/json" # For metadata
|
79 |
}
|
80 |
|
|
|
|
|
|
|
81 |
# Pass the binary data in the files parameter (do not include it in the JSON payload)
|
82 |
files = {
|
83 |
"VersionData": ("DPR_Report.pdf", pdf_data) # Tuple (filename, binary data)
|
84 |
}
|
85 |
|
86 |
-
# Debugging step: Log the metadata being sent
|
87 |
-
print("Content Version Payload:", json.dumps(content_version_payload, indent=4))
|
88 |
-
|
89 |
# Make the POST request to upload the file
|
90 |
response = requests.post(content_version_url, headers=headers, files=files)
|
91 |
|
@@ -104,7 +104,6 @@ def create_and_upload_pdf(dpr_content):
|
|
104 |
print("Error details from Salesforce response:", response.text)
|
105 |
raise Exception("Error uploading PDF to Salesforce: " + response.text)
|
106 |
|
107 |
-
|
108 |
# Function to generate the daily progress report (DPR) text
|
109 |
def generate_dpr(files):
|
110 |
# Query the latest Daily Progress Report records to get the highest number
|
|
|
78 |
"Content-Type": "application/json" # For metadata
|
79 |
}
|
80 |
|
81 |
+
# Debugging step: Log the payload being sent to Salesforce
|
82 |
+
print("Content Version Payload:", json.dumps(content_version_payload, indent=4))
|
83 |
+
|
84 |
# Pass the binary data in the files parameter (do not include it in the JSON payload)
|
85 |
files = {
|
86 |
"VersionData": ("DPR_Report.pdf", pdf_data) # Tuple (filename, binary data)
|
87 |
}
|
88 |
|
|
|
|
|
|
|
89 |
# Make the POST request to upload the file
|
90 |
response = requests.post(content_version_url, headers=headers, files=files)
|
91 |
|
|
|
104 |
print("Error details from Salesforce response:", response.text)
|
105 |
raise Exception("Error uploading PDF to Salesforce: " + response.text)
|
106 |
|
|
|
107 |
# Function to generate the daily progress report (DPR) text
|
108 |
def generate_dpr(files):
|
109 |
# Query the latest Daily Progress Report records to get the highest number
|