python 3.4 - How to request from multiple sources with urllib.request.Request? -


the following code makes single request yahoo api. how manage request multiple sources using urllib.request.request? aware of gerequests. if possible, there performance difference between two?

any suitable modules on topic?

    user_agent = 'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.0.7) gecko/2009021910 firefox/3.0.7'     headers = {'user-agent': user_agent, }      assembled_request = urllib.request.request(yahoo, none, headers)     response = urllib.request.urlopen(assembled_request)     html_data = response.read() 

there no way "bundle" multiple requests one, overhead needed generate request object on client should trivial anyway. pretty waiting request go through , server respond. if need send requests in bulk, doing asynchronously best way.

if using api on web query data, there equivalent of get_multiple() method can use instead of using get() x amount of times. might kind of thing looking for.

for example:

www.example.com/get_cat.html?brown=1 

might yield brown cat object.

while:

www.example.com/get_cats.html?brown=1 

might yield brown cat objects database contains.

these kinds of methods save time , bandwidth both server , client.


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -