gpt4 book ai didi

c# - 如何使用 Mono 获取 twitter user_timeline?

转载 作者:太空宇宙 更新时间:2023-11-03 16:04:52 25 4
gpt4 key购买 nike

我使用 Bobby's answer获取Twitter的用户时间线,代码非常简单易懂,我在Windows/.NET 4.5下试过,效果很好。

但是当我尝试使用完全相同的代码在 Ubuntu/Mono 2.10 上运行时,它抛出一个异常:

System.Net.WebException has been thrown
Error getting response stream (Write: The authentication or decryption has failed.): SendFailur

似乎 Mono 无法将 OAuth header 添加到 http 请求,那么有什么好的方法可以使用 Mono 获取 Twitter 用户时间线吗?

这是 StackTrace:

System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.Exception: The authentication or decryption has failed. ---> System.Exception: Invalid certificate received from server. Error code: 0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at test1.MainClass.Main (System.String[] args) [0x00207] in /home/jerry/test1/test1/Main.cs:89

最佳答案

好的,这是我的最终解决方案,导入 SSL 证书:

mozroots --import --ask-remove

它解决了我的问题。

关于c# - 如何使用 Mono 获取 twitter user_timeline?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19860140/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com