httprequest

Cannot find a dependent request in webtest

£可爱£侵袭症+ 提交于 2019-12-13 03:23:28
问题 I have recorded a test with my webtest recorder in VS2015. When I am rerunning the test,at one point it fails at a dependent GET request of a .css file. The url in the webtest result shows something like this https://mycompany/blah/ Style%20Guides/Global_CSS.css The error is a simple 404 error. Now I go to the main request and search for this particular dependent request so that I can set its Parse_Dependent_Request option as False or set the Extected_Http_Status_Code as 404, which ever works

Python Requests (Web Scraping) - Building a cookie to be able to view data in a website

六眼飞鱼酱① 提交于 2019-12-13 03:22:10
问题 I'm trying to scrape a finance website to make an application that compares the accuracy of financial data from various other websites (google/yahoo finance). This is a personal project that I started really just to learn Python programming and writing scripts. The URL I am trying to scrape (specifically the stock's "Key Data" like Market Cap, Volume, Etc) is here: https://www.marketwatch.com/investing/stock/sbux I've figured out (with the help of others) that a cookie must be built and sent

Fetch value from net/context in Golang

北城余情 提交于 2019-12-13 02:36:28
问题 I am using Golang net/context package for passing on the ID's wrapped in a context object from one service to another. I am able to pass the context object successfully but to actually retrieve the value of a particular key, the context.Value(key) always returns a nil. I am not sure why, but this is what I have done so far: if ctx != nil { fmt.Println(ctx) fmt.Println("Found UUID, forwarding it") id, ok := ctx.Value(0).(string) // This always returns a nil and thus ok is set to false if ok {

Sending data with POST, issue with character encoding

我的梦境 提交于 2019-12-13 02:15:32
问题 I am having issues with my NSURLRequest and doing a POST whenever the string includes %, for example. On my website, I can see that the encoding is ISO-8859-1,utf-8 for Accept-Charset but for some reason I cannot get the POST to work if it includes "%&$" etc. It seems like it won't encode it with UTF-8 encoding. Am I doing something wrong in the below code? NSData *postData = [credentials dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO]; NSString *postLength = [NSString

Python requests module GET/POST + various REST clients' requests taking longer than curl

孤街醉人 提交于 2019-12-13 01:50:08
问题 Basically, I have a url that I'm hitting to get some XML data. The endpoint I cannot disclose, but doing: curl -v "http://my-url.com/some/endpoint" returns a 200 OK and the content pretty much instantly. Using the requests module by Kenneth Reitz, I have both a POST request and a GET request that both take 30 seconds to return content. If I use it this way: from timeit import Timer t = Timer(lambda: requests.get(myurl).content) print t.timeit(number=1) 30.2136261463 it takes 30.2 sec on

How-to correctly pass params between Parse Cloud Code and the Client? (httpRequest Example)

Deadly 提交于 2019-12-13 01:06:22
问题 I've seen some examples, read the docs and read other question however I'm still not quite sure where to add/properly add params to be passed between Cloud Code and my Client side correctly. For Instance, Here I am creating a new class from a httpRequest in my Cloud Code In my Cloud Code main.js Parse.Cloud.define("POSTfromCloud", function(request, response) { //runs when Parse.Cloud.run("POSTfromCloud") on the client side is called Parse.Cloud.httpRequest({ method: "POST", headers: { "X

What are differences between XMLHttpRequest and HttpRequest

久未见 提交于 2019-12-13 00:12:13
问题 In Zend Framework and other framework such as Symfony, there is a method named isXMLHttpRequest() to determine this is XMLHttpRequest or not. I wonder that how can framework or PHP distinguish between XmlHttpRequest and HttpRequest? if($this->_request->isXmlHttpRequest()) { //code here } 回答1: From the documentation: Zend_Controller_Request_Http has a rudimentary method for detecting AJAX requests: isXmlHttpRequest(). This method looks for an HTTP request header X-Requested-With with the value

Get 32px favicon.ico

浪尽此生 提交于 2019-12-12 22:31:46
问题 Im trying to get the 32px favicon.ico of the websites, but the response it obtain is the 16px favicon, I guess because I´m trying to obtain it by the smarthphone, but I try to change the user agent of the http petition with no result here is my code: DefaultHttpClient client = new DefaultHttpClient(); String baseUrl = getBaseUrl(url); HttpGet httpGet = new HttpGet(baseUrl + "/favicon.ico"); httpGet.setHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko)

Cancelled AsyncTask hangs new HttpRequests

北城余情 提交于 2019-12-12 22:18:11
问题 I'm having problem with asynctasks and http requests. The user can press two different buttons. Both buttons download information from a web server. I want the requests to be cancelable. Before each call a progressdialog is shown. The http request is performed in an asynctask, and I have an OnDismiss listener on the progressdialog that cancels the asynctask if back is pressed. It works 50/50. If I do the http request, cancel the asynctask, then do a new request, it might work but it might

Set timeout to an http request in Tornado

天涯浪子 提交于 2019-12-12 21:13:04
问题 I have this part of code: como_url = "".join(['http://', options.como_address, ':', options.como_port, '/ztc_config?netid=0&opcode_group=0&opcode=0&start=-20s&end=-1s']) http_client = AsyncHTTPClient() response = yield tornado.gen.Task(http_client.fetch, como_url) where I do an http request. I would add a connection timeout, to be sure that the previous code is been executed, so I can find my response. How can I add the timeout? I have to add it into the tornado.gen.Task call? I don't know