请从位于此处的Mailgun文档中考虑此示例:http://documentation.mailgun.com/api-sending.html#examples
def send_complex_message():
return requests.post(
"https://api.mailgun.net/v2/samples.mailgun.org/messages",
auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
files=MultiDict([("attachment", open("files/test.jpg")),
("attachment", open("files/test.txt"))]),
data={"from": "Excited User <me@samples.mailgun.org>",
"to": "foo@example.com",
"cc": "baz@example.com",
"bcc": "bar@example.com",
"subject": "Hello",
"text": "Testing some Mailgun awesomness!",
"html": "<html>HTML version of the body</html>"})
Run Code Online (Sandbox Code Playgroud)
这不适合我.当电子邮件到达时,它只有一个附件.我在python-bottle中使用MultiDict对象.我打破了文件字典,所以我可以检查如下:
files=MultiDict([("attachment", ("file1.txt", "text file 1"),
("attachment", ("file2.txt", "text file 2")])
Run Code Online (Sandbox Code Playgroud)
当你执行files.values()时,它只有一个条目"file2.txt".这是有道理的.如果我尝试追加()一个条目,我会看到相同的行为.如果"密钥"相同(在这种情况下为"附件"),它将覆盖现有记录.
如果我给它提供了附件-1和附件2这样的唯一键,则API会接受帖子,但是邮件是在没有附件的情况下发送的.
所以我想我的问题是:
1)瓶子中的MultiDict对象是否存在差异导致其失败?它似乎在字典中有多个条目,不允许使用相同的密钥?
2)我是否应该做一些无记录的事情来向mailgun提交多个文件?还是不可能这样做?
第5行和第11行的括号是什么?
1 SELECT
2 s.name, s.ShirtDescription, c.Color,
3 z.Size, i.AvailableQTY, i.UnitPrice
4 FROM
5 (
6 test.ShirtInventory i
7 join test.Colors c ON
8 i.ColorID = c.id
9 join test.Shirts s ON
10 i.ShirtID = s.ID
11 )
12 JOIN test.Sizes z ON
13 i.SizeID = z.ID
14 WHERE .....
Run Code Online (Sandbox Code Playgroud)
我从未在FROM子句中看到过以这种方式使用的括号.这不是一个子查询,它没有确定表和连接的范围.您可以看到我在括号外引用i.SizeID的位置.当我第一次看到它时,我认为这可能是一种"提示"SQL Server如何获取数据的方法,但是当你删除parens时,执行计划中没有任何变化.
期待您的回复.编辑:错误的行