How to send multiple http requests python

bitgeeky

I am using python request.post() to send data to a remote database. How should I send more than one request(around 20-30) on same URL using different data using python ?

Also, will sequential work fine for this case or do I need to make the requests in parallel ?

Padraic Cunningham

You should look at grequests which uses requests and gevent

import grequests

urls = [
    'http://www.heroku.com',
    'http://python-tablib.org',
    'http://httpbin.org',
    'http://python-requests.org',
    'http://kennethreitz.com'
]

rs = (grequests.get(u) for u in urls)
grequests.map(rs)
[<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to send multiple HTTP requests using Python

Python: How can i send multiple HTTP requests and receive the response?

Challenge: How to send > 1000 HTTP requests in one second with Python

How to send 10,000 HTTP requests concurrently using Python

send multiple http requests using same socket

Java best way to send multiple HTTP requests

How to make multiple http requests?

How to send http requests dynamically in Gatling?

How do HTTP redirect requests send cookies?

how to send multiple requests using same client?

How to send multiple POST requests in JavaScript

How to send multiple requests asynchronously in JavaScript?

How to send multiple 'GET' requests using get function of requests library?

How to submit multiple requests to the function to send all submitted requests

How to replay HTTP requests in Python

How to send asynchronous HTTP requests from Django and wait for results in python2.7?

python- How to properly send http GET requests to different Host-IPs but same host

Python: Multiple HTTP requests at the same time

How to speed up multiple sequential http requests in Python using Http.Client

Angular - How to implement switchMap for multiple http requests?

How to use multiple Http Requests in Angular 4

How to handle multiple http requests in my case?

How to make multiple http requests in my case

Scrapy send multiple requests

how to send a list in python requests GET

python requests How to send data to a website

Python requests, how to send json request without " "

How to send image to Strapi with Python Requests?

python, send many HTTP requests through one network connection