我没有使用 ORM,我希望这样做:
table = 'foo'
engine.execute('SELECT * from %s', (table))
Run Code Online (Sandbox Code Playgroud)
问题是变成了:
SELECT * FROM 'foo'
Run Code Online (Sandbox Code Playgroud)
代替
SELECT * FROM foo
Run Code Online (Sandbox Code Playgroud)
我找不到有关可用 % 参数的文档。我试过 %b 但它不受支持。
在不使用 ORM 的情况下,最好的方法是什么?
文档非常令人沮丧。
我正在使用上传小部件来尝试允许用户为其个人资料上传多张图片。我不能使用未签名的上传,因为可能会被滥用。
我宁愿通过上传小部件而不是通过服务器上传文件,因为它看起来应该如此简单
我已经拼凑了我认为应该有效的内容,但它仍然说:Upload preset must be whitelisted for unsigned uploads
服务器:
// grab a current UNIX timestamp
const millisecondsToSeconds = 1000;
const timestamp = Math.round(Date.now() / millisecondsToSeconds);
// generate the signature using the current timestmap and any other desired Cloudinary params
const signature = cloudinaryV2.utils.api_sign_request({ timestamp }, CLOUDINARY_SECRET_KEY);
// craft a signature payload to send to the client (timestamp and signature required)
return signature;
Run Code Online (Sandbox Code Playgroud)
也尝试过
return {
signature,
timestamp,
};
Run Code Online (Sandbox Code Playgroud)
也尝试过
const signature = cloudinaryV2.utils.api_sign_request(
data.params_to_sign,
CLOUDINARY_SECRET_KEY,
); …Run Code Online (Sandbox Code Playgroud)