python requests

This is the place for queries that don't fit in any of the other categories.

python requests

Postby siestamadokaist » Sat Apr 27, 2013 2:39 pm

could anyone enlighten me, what is the different between
Code: Select all
start = int(round(time.time() * 1000))
r = requests.get(url, stream=True);         
for i in r.iter_content(32):         
   a = i;   
   break;
end = int(round(time.time() * 1000))         

and
Code: Select all
start = int(round(time.time() * 1000))
r = requests.get(url, stream=True);         
end = int(round(time.time() * 1000))         

ther
A certain mmorpg site blocked ping packet from transfering, so I planned to create a dummy replacement to get/send 32 byte packet, and check the delay. But I don't want to waste too much of my inet capacity either just for a ping. Since after I printed the r.content from each code, both give me the full html of the page.

~thank you.
siestamadokaist
 
Posts: 12
Joined: Sun Mar 31, 2013 4:48 pm

Re: python requests

Postby Yoriz » Sat Apr 27, 2013 3:01 pm

this is the bit that's different
Code: Select all
for i in r.iter_content(32):         
   a = i;   
   break;

its iterating some results assigning the value to a variable which it does nothing with and then calling break which is not required in that piece of code, Note ';' does nothing in python code.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 565
Joined: Fri Feb 08, 2013 1:35 am
Location: UK


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 2 guests