首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Postmates不起作用

Postmates不起作用
EN

Stack Overflow用户
提问于 2017-02-28 15:27:57
回答 1查看 504关注 0票数 1

我在过去的一年里一直在使用postmates Quote API,当我检查的时候,它工作得很好。

但是现在它似乎不起作用了。

它抛出了一个包含一些启用cookie和验证码的HTML文本的异常

我不明白我是不是错过了postmates的一些更新

下面是我的代码

代码语言:javascript
复制
HttpWebRequest req = WebRequest.Create(new Uri("https://api.postmates.com/v1/customers/" + PostmatesCustomerId + "/delivery_quotes")) as HttpWebRequest;

            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            req.Headers.Add("Authorization", "Basic " + Base64string);             

            StringBuilder paramz = new StringBuilder();
            paramz.Append("pickup_address=" + PickUpAddress + "&dropoff_address=" + DeliveryAddress);

            byte[] formData =
                UTF8Encoding.UTF8.GetBytes(paramz.ToString());
            req.ContentLength = formData.Length;

            // Send the request:
            using (Stream post = req.GetRequestStream())
            {
                post.Write(formData, 0, formData.Length);
            }
            string responseString = null;
            using (HttpWebResponse resp = req.GetResponse()
                                          as HttpWebResponse)
            {
                StreamReader reader =
                    new StreamReader(resp.GetResponseStream());
                responseString = reader.ReadToEnd();
            }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-01 06:21:03

如果您不在美国,可以尝试使用VPN作为测试的变通方法。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42502638

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档