Problem making multiple parallel http post requests?

Nighcore2

Registered Member
Joined
Apr 30, 2019
Messages
69
Reaction score
4
Im new to python and to programing and im stucked trying to make 25/50/100 http requests to the same url in paralell.

Problems:
1-Before each request, i make one requests to 2captcha servers
2-Before each request i get random proxy from a list


i dont know how to run all http post in parallel running before each 2captcha request

Code:
import requests
import re
from proxy import proxy as ez #returns random proxy
from captcha import captcha_use #2captcha api, returns captcha solved
from time import gmtime, strftime
from fake_headers import Headers
def send_code(z):
    #try:

        captcha = captcha_use() #returns 2captcha recaptcha response
        proxies = {
        # 'http' : ez(),
        'https': ez()#returns random proxy
        }

        url = "https://ex.com/sss/"
        data = {
            'codigo': z,
            'g-recaptcha-response': captcha

        }

        headers = Headers(headers=True).generate()

        r = requests.post(url, data=data,proxies=proxies,headers=headers)
        print(r.status_code)
        z = strftime("%Y-%m-%d %H:%M:%S", gmtime())
        print(z)
        #send_code("Llamada hecha : "+ z )
        if 'string' in r.text:
           print('zzz')
 
Last edited:
Back
Top