我遇到了C#和简单的HTTPS-Request问题......
我想请求这个URL:https://api.sipgate.com/v1/在webbrowser中,它工作正常,但我的C#-Code不起作用:(有谁知道我做错了什么?谢谢!
using System.Net;
using System.IO;
// [...]
WebRequest req = WebRequest.Create("https://api.sipgate.com/v1");
req.ContentType = "application/json";
try {
WebResponse res = req.GetResponse(); // Exception here...
Stream content = res.GetResponseStream();
Console.WriteLine((new StreamReader(content)).ReadToEnd());
} catch (Exception e) {
Console.WriteLine(e.ToString());
}
Run Code Online (Sandbox Code Playgroud)
这是一个例外:
System.Net.WebException: Die zugrunde liegende Verbindung wurde geschlossen: Unerwarteter Fehler beim Senden.. ---> System.IO.IOException: Fehler bei Authentifizierung, da die Gegenseite den Transportstream geschlossen hat.
bei System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
bei System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, …Run Code Online (Sandbox Code Playgroud) 我想从带有模块多处理的 GUI (wxPython) 启动一个简单的 HTTP 服务器。
如果我直接用 Python 启动它,这段代码就可以正常工作。但是在构建版本(使用 PyInstaller 2 或 3)中,如果我启动 multiprogress -> 不是运行函数中的代码,整个应用程序,GUI 会再次启动。有人知道为什么吗?
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import wx, sys, time, thread, datetime, os, platform, multiprocessing, socket
import favicon
from genLicense import load as loadLicense
from licenseDetailDialog import Dialog as licenseDetailDialog
class mp(multiprocessing.Process):
def __init__(self, queue, func, *args):
multiprocessing.Process.__init__(self)
self.queue = queue
self.func = func
self.args = args
def run(self):
time.sleep(0.1)
try:
self.func(*self.args)
except Exception as e:
self.queue.put(e)
print(e)
class MainFrame(wx.Frame):
def __init__(self, …Run Code Online (Sandbox Code Playgroud) 我在 python 3.7 中使用 postgres 和 sqlalchemy
我有一个类型为“time with timezone”的列并尝试插入一个新行。
TAB = Table("tab", METADATA,
# ...
Column('created', DateTime(timezone=True), default=datetime.now)
)
Run Code Online (Sandbox Code Playgroud)
现在我尝试插入一个新行。我收到了这条消息:
(psycopg2.ProgrammingError) column "created" is of type time with time zone but expression is of type timestamp without time zone
Run Code Online (Sandbox Code Playgroud)
有人知道我必须做什么吗?
谢谢!
python ×2
.net ×1
c# ×1
datetime ×1
https ×1
postgresql ×1
pyinstaller ×1
request ×1
sqlalchemy ×1
time ×1
web ×1
wxpython ×1