我需要使用来自https://wl-api.mf.gov.pl/api/search/nip/5250007738?date=2020-02-13的 json 读取基于税务识别的信息
并且有工作代码示例
private static void Main()
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Log("NIP: ");
string nip = Console.ReadLine();
string date = DateTime.Now.ToShortDateString();
string url = "https://wl-api.mf.gov.pl/api/search/nip/{0}?date={1}";
string fullUrl = string.Format(url, nip, date);
var get = Get(fullUrl);
RootObject account = JsonConvert.DeserializeObject<RootObject>(get);
if (account != null)
Log("Status: " + account.result.subject.statusVat);
Log("Press any key to continue...");
Console.ReadKey();
}
public static string Get(string url)
{
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
catch (Exception err)
{
Log(err.Message);
}
return string.Empty;
}
static void Log(string msg)
{
Console.WriteLine(msg);
}
但是 API 有一些限制,我每天只能收到 10 个请求。但是,使用网络浏览器我可以不受任何限制地获得它。有没有办法绕过429限制?