Python requests library - Strange behavior vs curl -


i comparing these 2 code snippets:

subprocess.call('curl -xget http://localhost:81/proxy/bparc/my_key > /dev/null' ,shell=true) 

vs

response = requests.get('http://localhost:81/proxy/bparc/my_key') print len(response.text) 

and first 1 run in under .01 seconds. second 1 times take 30 seconds, , other times take less .01 seconds.

any ideas going on? requests doing fancy that's slowing things down? bad run len?

ok, changing response.content fixed it. response.text lot of stuff don't need binary data.

response = requests.get('http://localhost:81/proxy/bparc/my_key') print len(response.content) 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -