小编Jac*_*dge的帖子

如何阻止pyCharm抱怨下划线字符串?

我在pyCharm中编写一个wxPython项目(主要是从wxGlade生成).如果我有一些指定字符串的代码,例如:

value_label = wx.StaticText(self, wx.ID_ANY, _("Value"))
Run Code Online (Sandbox Code Playgroud)

然后抱怨Unresolved reference '_'.有没有办法只忽略这个未解决的参考?

python wxglade pycharm

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

尝试使用aiohttp构建代理

我正在尝试使用aiohttp编写转发http代理,我目前正在使用http,但希望它能够与https一起使用(无需解密).

import asyncio
from aiohttp import web, ClientSession

loop = asyncio.get_event_loop()


async def handler(server_request):
    if server_request.method == "CONNECT":
        print(await server_request.read())
    else:
        async with ClientSession() as session:
            async with session.request(server_request.method, server_request.raw_path) as request:
                response = web.StreamResponse(status=200,
                                              reason='OK',
                                              headers={'Content-Type': 'text/html'})
                await response.prepare(server_request)
                while True:
                    chunk = await request.content.read()
                    if not chunk:
                        break
                    response.write(chunk)
                return response


server = web.Server(handler)
loop.run_until_complete(loop.create_server(server, "0.0.0.0", 8080))
try:

    loop.run_forever()
except KeyboardInterrupt:
    loop.close()
    pass
Run Code Online (Sandbox Code Playgroud)

我已经到了我需要让原始的身体将隧道送到目的地,但似乎无法访问它

如果我尝试阅读,我会得到一个例外:

b''
Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/web_protocol.py", line 434, in …
Run Code Online (Sandbox Code Playgroud)

python https proxy python-3.x aiohttp

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

Cognito 用户迁移触发器未触发

在 eu-west-1 的认知用户池中。我正在尝试为用户迁移添加触发器。当我尝试以不存在的用户身份登录时,它不会触发。我已经通过编写一个简单的 python lambda 测试了这一点:

def handler(event, context):
    print(event)
    return event
Run Code Online (Sandbox Code Playgroud)

在日志中,如果用户不存在,我永远不会看到此运行。然后我尝试设置所有触发器以使用我看到的这个 lambda(使用现有用户登录时):

  • PreAuthentication_Authentication
  • PostAuthentication_Authentication
  • TokenGeneration_Authentication

当使用不存在的用户登录时,即。迁移候选人 - 我没有看到触发器被触发。

这是地区特定的问题吗?我们是否需要启用触发器才能触发?我们是否需要为非授权用户或登录失败触发的触发器启用特定权限?

amazon-web-services amazon-cognito aws-lambda

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