Rank 2: Process
This is my python function, and I'm not sure why it fails when run it in console
What am I doing wrong?
def main(req, res):
payload = req.payload or 'No payload provided. Add custom data when executing function.'
secretKey = req.variables.get(
'API_KEY_HERE',
'SECRET_KEY variable not found. You can set it in Function settings.'
)
client = Client()
(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('PROJECT_ID_HERE') # Your project ID
.set_key('API_KEY_HERE') # Your secret API key
)
databases = Databases(client)
result = databases.create_document('DATABASE_ID_HERE', 'COLLECTION_ID_HERE', 'ID.unique()', {
'Name': 'user123',
'Logo': 'https://images1-fabric.practo.com.png',
'Title': 'title123',
'Location': 'loc1'
},)
return res.json({
'message': 'Hello from Appwrite!',
'payload': payload,
'result': result
})