我正在尝试使用Mandrill和PHP发送电子邮件,我无法发送它.
我从这里下载了PHP API包装器:https://packagist.org/packages/mandrill/mandrill
Mandrill.php在我的根目录中,Mandrill文件夹在同一目录中.
这是我的代码:
<?php
require_once 'Mandrill.php';
$mandrill = new Mandrill('MY API KEY IS USUALLY HERE');
$message = array(
'subject' => 'Test message',
'from_email' => 'jwjody@yahoo.com',
'from_name' => 'Sender person',
'html' => '<p>this is a test message with Mandrill\'s PHP wrapper!.</p>',
'to' => array(array('email' => 'jwjody@yahoo.com', 'name' => 'Recipient 1')),
'merge_vars' => array(array(
'rcpt' => 'recipient1@domain.com',
'vars' =>
array(
array(
'name' => 'FIRSTNAME',
'content' => 'Recipient 1 first name'),
array(
'name' => 'LASTNAME',
'content' => 'Last …Run Code Online (Sandbox Code Playgroud) 我发布了一个早期的问题:angular-ui-bootstrap:使用popover-html在popover中实现html,并建议我使用popover-template.
<i popover-template="popover-partial.html" popover-title="In Progress" class="glyphicon glyphicon-info-sign"></i>
<script type="text/ng-template" id="popover-partial.html">
<b>Jody</b>
</script>
Run Code Online (Sandbox Code Playgroud)
所以我试图这样做,但现在弹出窗口不会在点击时激活.
我使用的是版本0.13.4.
我有以下CloudFormation脚本.正在创建堆栈并启动Ec2实例,我可以通过SSH进行安装但不安装软件包.
我不知道它在哪里失败了.我正在使用Ubuntu.我找不到在我的实例上安装了cfn-init?或者它是否仅为Amazon Linux AMI安装?
我该如何解决此问题?
{
"Parameters" : {
"ShinyKey": {
"Description": "Key pair for instance.",
"Type": "AWS::EC2::KeyPair::KeyName"
}
},
"Resources": {
"Ec2Instance" : {
"Metadata": {
"AWS::CloudFormation::Init": {
"config": {
"packages": {
"apt": {
"r-base-dev": [],
"libcurl4-openssl-dev": [],
"git": []
}
}
}
}
},
"Type" : "AWS::EC2::Instance",
"Properties": {
"ImageId": "ami-9eaa1cf6",
"InstanceType": "t2.micro",
"KeyName": {"Ref": "ShinyKey"},
"SecurityGroups": [{"Ref": "InstanceSecurityGroup"}],
"Tags": [{
"Key": "Name",
"Value": "R-Shiny-Server"
}],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash\n",
"/usr/local/bin/cfn-init --region ", …Run Code Online (Sandbox Code Playgroud) 我试图刮一个有这样一节的页面:
<a name="id_631"></a>
<hr>
<div class="store-class">
<div>
<span><strong>Store City</strong</span>
</div>
<div class="store-class-content">
<p>Event listing</p>
<p>Event listing2</p>
<p>Event listing3</p>
</div>
<div>
Stuff about contact info
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
该页面是这样的部分列表,区分它们的唯一方法是使用<a>标记中的name属性.
所以我想我想要那个目标然后转到next_sibling <hr>然后再到下一个兄弟来获得该<div class="store-class">部分.我想要的只是div标签中的信息.
我不确定如何将该<a>标记定位为向下移动两个兄弟姐妹.当我尝试时print(soup.find_all('a', {"name":"id_631"})),只是给我标签中的内容,这没什么.
这是我的脚本:
import requests
from bs4 import BeautifulSoup
r = requests.get("http://www.tandyleather.com/en/leathercraft-classes")
soup = soup = BeautifulSoup(r.text, 'html.parser')
print(soup.find("a", id="id_631").find_next_sibling("div", class_="store-class"))
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
Traceback (most recent call last):
File "tandy.py", line 8, in <module>
print(soup.find("a", id="id_631").find_next_sibling("div", class_="store-class"))
AttributeError: 'NoneType' object has no …Run Code Online (Sandbox Code Playgroud)