小编cot*_*oto的帖子

gpg加密文件没有键盘交互

我在crontab中运行下一个命令来加密文件,我不想进行键盘交互

echo "PASSPHRASE" | gpg --passphrase-fd 0 -r USER --encrypt FILENAME.TXT
Run Code Online (Sandbox Code Playgroud)

但我有这个答案:

gpg: C042XXXX: There is no assurance this key belongs to the named user

pub  40XXX/C042XXXX 2012-01-11 Name LastName. (comment) <user@email.com>
 Primary key fingerprint: XXXX XXXX XXXX XXXX XXXX  XXXX XXXX XXXX XXXX XXXX
      Subkey fingerprint: XXXX XXXX XXXX XXXX XXXX  XXXX XXXX XXXX XXXX XXXX

It is NOT certain that the key belongs to the person named
in the user ID.  If you *really* know what you are …
Run Code Online (Sandbox Code Playgroud)

bash gnupg crontab

74
推荐指数
4
解决办法
7万
查看次数

Django vs App Engine上的webapp2

我想知道您对这两个Web框架(Django和webapp2)中的哪一个更适合在App Engine平台上使用,以及为什么?

请不要说两者完全不同,因为Django更加完整.两者都是您可以在App Engine中使用的"Web框架".

python django google-app-engine python-2.7 webapp2

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

上传Google App Engine应用程序时出错

我使用普通命令在Google App Engine中上传我的应用程序(Python 2.7,SDK 1.8.9):

appcfg.py --oauth2 update .
Run Code Online (Sandbox Code Playgroud)

但是在我的项目中进行重构之后,app.yaml的正则表达式中出现了错误(这是代码)

错误是:

02:00 AM Application: sandengine; version: dev
02:00 AM Host: appengine.google.com
02:00 AM Starting update of app: sandengine, version: dev
02:00 AM Getting current resource limits.
02:00 AM Scanning files on local disk.
Traceback (most recent call last):
  File "/usr/local/bin/appcfg.py", line 199, in <module>
    run_file(__file__, globals())
  File "/usr/local/bin/appcfg.py", line 195, in run_file
    execfile(script_path, globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4933, in <module>
main(sys.argv)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 4924, in main
result …
Run Code Online (Sandbox Code Playgroud)

google-app-engine yaml python-2.7 app.yaml

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

NDB查询按KeyProperty过滤

我在ndb模型中有一个类方法,我按"用户"(没有问题)和"行业"过滤.

问题是实体建议书没有工业产权,但拥有股票属性是股票的KeyProperty,Stock拥有行业属性

如何修复get_last_n_recommendations_for_user_and_industry方法按行业过滤,这是Stock的KeyProperty?

class Industry(ndb.Model):
    name = ndb.StringProperty()
    ...

class Stock(ndb.Model):
    name = ndb.StringProperty()
    industry = ndb.KeyProperty(kind=Industry)
    ...

    @classmethod
    def get_industry(cls):
        return cls.query(cls.ticker == cls).get().industry

class Recommendation(ndb.Model):
    user = ndb.KeyProperty(kind=User)
    stock = ndb.KeyProperty(kind=Stock)
    ...

    @classmethod
    def get_last_n_recommendations_for_user_and_industry(cls, stock_key, user_key, n):
        return cls.query(
                cls.user == user_key, 
                cls.stock.get().industry == ndb.Key('Stock', stock_key.string_id()).get().industry
            )
            .fetch(page_size)
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我有这个错误:

AttributeError: 'KeyProperty' object has no attribute 'get'
Run Code Online (Sandbox Code Playgroud)

python google-app-engine app-engine-ndb google-cloud-datastore

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