为什么尝试访问此URL时出现406错误,这是不可接受的

时间:2019-01-17 04:19:11

标签: api

我可以使用Firefox轻松打开URL

https://api.kucoin.com/v1/open/tick

但是,我无法使用vb.net webclient(cookieawarewebclient只是webclient)打开它

我需要其他标题吗? wc.headers为空

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
        waitTing(0.01)
    Next
    Return response
End Function

0 个答案:

没有答案