小编Joh*_*mes的帖子

使用Elasticsearch进行连接超时

from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()

doc = {
    'author': 'kimchy',
    'text': 'Elasticsearch: cool. bonsai cool.',
    'timestamp': datetime(2010, 10, 10, 10, 10, 10)
}
res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
print(res['created'])
Run Code Online (Sandbox Code Playgroud)

这个简单的代码返回以下错误:

elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10))
Run Code Online (Sandbox Code Playgroud)

很奇怪,因为服务器已准备好并设置(http:// localhost:9200 /正在返回一些json).

提前致谢!

python python-2.7 elasticsearch

67
推荐指数
7
解决办法
6万
查看次数

材料中的文本区域-ui

有人可以帮我使用material-ui库在TextArea中创建TextField个性化吗?我没有找到任何应​​该将其个性化为TextArea的参数:https://github.com/callemall/material-ui/blob/v1-beta/src/TextField/TextField.d.ts

这是TextArea:https://material.io/guidelines/components/text-fields.html#text-fields-field-types(CMD/Ctrl + F'文本区域').

文本区域高于文本字段,并将溢出文本换行到新行.当光标到达字段底部时,它们会垂直滚动.

提前致谢,

javascript reactjs material-ui

18
推荐指数
3
解决办法
2万
查看次数

同一用户的多个Facebook ID

我在公共链接中抓取用户评论及其用户ID以构建图表,我注意到一些用户有多个ID.例如,此用户有两个不同的ID:100000571429851和993673107328394.

我没有使用不同的aps来获取用户ID(有人告诉我不同​​应用程序之间的用户ID更改).

关于如何为每个用户获取真正唯一ID的任何想法?

facebook graph facebook-graph-api facebook-graph-api-v2.2

14
推荐指数
1
解决办法
5416
查看次数

gpg:无法连接到代理:IPC连接呼叫失败

我在尝试使用GPG解密某些密钥时遇到问题.以下输出给了我:

gpg: can't connect to the agent: IPC connect call failed
Run Code Online (Sandbox Code Playgroud)

我已经编辑了一些文件,在本教程中指出:https://michaelheap.com/gpg-cant-connect-to-the-agent-ipc-connect-call-failed/但没有成功.

可能的原因是什么?

提前致谢

gnupg

14
推荐指数
7
解决办法
1万
查看次数

Python datetime.utcnow()返回不正确的日期时间

datetime.utcnow()
Run Code Online (Sandbox Code Playgroud)

此调用返回的日期时间不正确,从UTC/GMT延迟1小时(请登录:http://www.worldtimeserver.com/current_time_in_UTC.asp).

它应该像它应该的那样工作吗?

例如,它现在正在返回:

2015-02-17 23:58:44.761000.
Run Code Online (Sandbox Code Playgroud)

当前UTC时间是:00:58,而不是23:58

python datetime utc python-2.7

10
推荐指数
2
解决办法
3万
查看次数

Django Runserver日志输出到文件中

如何打印来自python manage.py runserver日志文件的日志(而不是在控制台内部显示)。

这是我要保存到日志文件中的日志示例:

Performing system checks... System check identified no issues (0 silenced). November 19, 2015 - 01:37:54 Django version 1.8.5, using settings 'simpatize.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.

python django

5
推荐指数
1
解决办法
1184
查看次数

如何以非交互式方式为 gcloud CLI 传递数据库密码?

我正在尝试以非交互式方式将密码传递给 gcloud sql connect 命令。我想要实现的不是要求输入密码,而是以某种方式将其传递到命令中。

不确定基于文档是否可能,但另一方面,它对于自动化任务非常有用,我坚信有一种方法可以做到这一点......

命令:

gcloud sql connect <database_name> --user=<user_name>
Run Code Online (Sandbox Code Playgroud)

google-cloud-sql google-cloud-platform gcloud

5
推荐指数
1
解决办法
960
查看次数

如何导入上面和下面两个目录中的Python类?

如何customer_helper.py从里面导入CustomerHelper类customer_helper_test.py?这是可能的?我用过,from ..helpers..tests..app.helpers.customer_helper import CustomerHelper但它的语法无效.

这是有组织的文件夹:

program/
    app/
        helpers/
            customer_helper.py
            __init__.py
    __init__.py
    tests/
        helpers/
            customer_helper_test.py
            __init__.py
        __init__.py
    __init__.py
Run Code Online (Sandbox Code Playgroud)

提前致谢!

python class file python-2.7 python-3.x

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