小编Fil*_*ano的帖子

Google Webmater Tools出现HttpResponse错误

我正在尝试按照本指南使用Google网站管理员工具

我实现了我的网址

(r'^googlece9fb428b0c84a39\.html$', lambda r: HttpResponse("google-site-verification: googlece9fb428b0c84a39.html", mimetype="text/plain")),
Run Code Online (Sandbox Code Playgroud)

但是在访问url时我收到以下错误:

NameError at /googlece9fb428b0c84a39.html
global name 'HttpResponse' is not defined
Run Code Online (Sandbox Code Playgroud)

django google-webmaster-tools

2
推荐指数
1
解决办法
5608
查看次数

AttributeError:'Session'对象没有属性'save'

我正在尝试使用SQLAlchemy,但是在行中:

session.save(login)
Run Code Online (Sandbox Code Playgroud)

我收到这个错误:

AttributeError: 'Session' object has no attribute 'save'
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

def findOrCreateLogin(self, username, password):
    login = self.findLogin(username)
    if login:
        return login
    else:
        login = DBLogin(username,password)
        session.save(login)
        return login
Run Code Online (Sandbox Code Playgroud)

python sqlalchemy

2
推荐指数
1
解决办法
3008
查看次数

ionic不安装app

我正试图在ios模拟器上用离子模拟我的应用程序.但是当我跑步时:

ionic build ios
ionic emulate ios
Run Code Online (Sandbox Code Playgroud)

我的应用程序没有出现在模拟器上.我该怎么办?

javascript ios cordova ionic

2
推荐指数
1
解决办法
576
查看次数

使用 Goutte 获取 div

我正在尝试使用Goutte从这个url获取数据 但是当我尝试仅过滤具有“empresa”类的 div 时,我得到了整个页面。如何仅过滤具有特定类的 div?

这是我的代码:

<html>

<body>
        <?php

        require __DIR__ . '/vendor/autoload.php';
        use Goutte\Client;

        $client = new Client();
        $crawler = $client->request('GET', 'http://sp.cadastrosindustriais.com.br/?consulta=cal%C3%A7ados');

        $crawler->filter('div[id="empresa"]')->each(function ($node) {
            print $node->text()."\n";
        });


        ?>

</body>


</html>
Run Code Online (Sandbox Code Playgroud)

php goutte

2
推荐指数
1
解决办法
5247
查看次数

Error: Missing where attribute in the options parameter passed to findOrCreate.

I'm trying to use sequelize findOrCreate function, but I'm getting this error:

Error: Missing where attribute in the options parameter passed to findOrCreate. 
Run Code Online (Sandbox Code Playgroud)

This is my code:

var values = { slack_id: profile.id, name: profile.user };
var selector = { where: { slack_id: profile.id } };
User.findOrCreate(values, selector)
            .then(function() {
                return done(err, user);
            });
Run Code Online (Sandbox Code Playgroud)

javascript node.js sequelize.js

2
推荐指数
1
解决办法
3935
查看次数

在osx El Capitan中找不到openssl命令

我正在尝试按照本教程更新OpenSSL

我跑:

brew update && brew upgrade
brew install openssl
brew link --force openssl
sudo ln -s /usr/local/Cellar/openssl/1.0.2j/bin/openssl /usr/bin/openssl
mkdir -p /usr/local/lib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
Run Code Online (Sandbox Code Playgroud)

当我检查

ls -l /usr/local/opt/openssl
Run Code Online (Sandbox Code Playgroud)

我明白了:

lrwxr-xr-x  1 Filipe  admin  24 Apr 29 12:48 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2k
Run Code Online (Sandbox Code Playgroud)

但是当我跑步时:

openssl version -a
Run Code Online (Sandbox Code Playgroud)

我明白了:

-bash:openssl:找不到命令

我已经重启了终端,但没有改变.

macos ssl homebrew openssl

2
推荐指数
1
解决办法
3032
查看次数

如何使用 boto3 在 Amazon SES 中更改 FROM 名称

我正在尝试from使用 boto3更改电子邮件客户端中显示的名称。但我无法做到这一点。

这是我的代码:

client = boto3.client(
        'ses',
        aws_access_key_id=AWS_ACCESS_KEY,
        aws_secret_access_key=AWS_SECRET_KEY,
        region_name='us-west-2'
    )

    response = client.send_email(
        Destination={
            'ToAddresses': [
                to_address,
            ],
        },
        Message={
            'Body': {
                'Html': {
                    'Charset': 'UTF-8',
                    'Data': html_content,

                },
                'Text': {
                    'Charset': 'UTF-8',
                    'Data': 'Email formato text.',
                },
            },
            'Subject': {
                'Charset': 'UTF-8',
                'Data': subject,
            },
        },
        Source='no-reply@example.com.br',
    )
Run Code Online (Sandbox Code Playgroud)

from客户端总是因为没有答复,我如何更改为自定义名称?

amazon-ses boto3

2
推荐指数
1
解决办法
1448
查看次数

错误:命令“clang”在 pip install TA-Lib 上失败,退出状态为 1

我正在尝试在 Mac Sierra 中安装 TA-Lib:

须藤 pip 安装 TA-Lib

但我收到此错误:

 error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-bqV3xq/TA-Lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-5HBbJo-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-bqV3xq/TA-Lib/
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

python macos

2
推荐指数
1
解决办法
9588
查看次数

估算器管道的无效参数丢失

我正在尝试使用sklearn实现SGDClassifier,但出现此错误:

ValueError: Invalid parameter loss for estimator Pipeline. Check the list of available parameters with `estimator.get_params().keys()`.
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

pipeline = Pipeline([
 ('clf', SGDClassifier())
])

parameters = {
    'seed': [0],
    'loss': ('log', 'hinge'),
    'penalty': ['l1', 'l2', 'elasticnet'],
    'alpha': [0.001, 0.0001, 0.00001, 0.000001]
}

score_func = make_scorer(metrics.f1_score)

grid_search = GridSearchCV(pipeline, parameters, n_jobs=3,
verbose=1, scoring=score_func)

grid_search.fit(X, Y)
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

python scikit-learn

2
推荐指数
1
解决办法
2356
查看次数

无法在Ubuntu上安装TA-Lib

我正在尝试在Ubuntu中安装Python Ta-Lib,但是当我运行时:

pip install TA-Lib
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YfCSFn/TA-Lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-swmI7D-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-YfCSFn/TA-Lib/
Run Code Online (Sandbox Code Playgroud)

我已经安装了:

sudo apt-get install python3-dev
Run Code Online (Sandbox Code Playgroud)

并安装了Ta-lib

我怎样才能解决这个问题?

python ubuntu

2
推荐指数
2
解决办法
6070
查看次数