原因很简单
现在它要求输入验证码。
我可以访问
https://c-cex.com/t/api_pub.html?a=getmarketsummaries在浏览器上,执行captca,我可以接受。
但是我的程序不能。
这是失败的代码
Public Shared Function downloadString1(url As String, post As String, otherHeaders As Tuple(Of String, String)()) As String
Dim wc = New CookieAwareWebClient()
For Each oh In otherHeaders
wc.Headers.Add(oh.Item1, oh.Item2)
Next
Dim response = String.Empty
For i = 1 To 1
Try
If post = "" Then
response = wc.DownloadString(url)
Else
If post.Contains("=") Then
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
End If
response = wc.UploadString(url, post)
End If
Catch ex As Exception
Dim a = 1
End Try
If response = "" Then
Sleep(1000)
Else
Exit For
End If
Next
Return response
End Function
并且应该将API用作程序。
有没有解决的办法?
或者我应该抱怨c-cex关于其API的支持。
这是设计缺陷吗?
注意:让我为您展示屏幕截图
答案 0 :(得分:1)
API不能真正要求CAPCHA,因为这是一种挑战用户是人类的机制。根据定义,几乎没有API。如果您需要任何挑战,通常是通过密钥,客户端证书或用户名/密码来完成身份验证和授权。
如果该URL确实被设计为API,那么我同意这是一个设计缺陷。使用它时,它实际上并没有要求我提供验证码。