import requests
import json
def send_zoho_request():
headers = {
"Authorization": f"Zoho-oauthtoken {ZOHO_ID}"
}
files = {
'file': ('acuerdo_firma.pdf', open('acuerdo_firma.pdf', 'rb'))
}
data = {
"requests": [{
"request_name": "Social Media policy",
"actions": [{
"recipient_email": "example@gmail.com",
"action_type": "SIGN",
"recipient_name": "Sebastian",
"private_notes": "Please get back to us for further queries"
}]
}]
}
# Convert the data dictionary to a JSON string
json_data = json.dumps(data)
payload = {'data': json_data}
response = requests.post(url, headers=headers, files=files, json=payload)
if response.status_code == 200:
print(response.json())
return response.json()
else:
return f"Error: {response.status_code}, {response.text}"
# Usage
response = send_zoho_request()
print(f"Request ID: {response['requests']['request_id']}")
import requests
def send_zoho_submit(request_id):
headers = {
"Authorization": f"Zoho-oauthtoken {ZOHO_ID}"
}
# Body of the request
data = {
"requests": {
"actions": [
{
"verify_recipient": False,
"action_id": f"{request_id}",
}
]
}
}
# Sending the POST request
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
return "Request submitted successfully"
else:
return f"Error: {response.status_code}, {response.text}"
# Usage
# This is the RequestId from the image
result = send_zoho_submit(response['requests']['request_id'])
print(result)