• 06-01-2024, 22:01:39
    #1
    Aşağıdaki kodlar ile websitesine bağlanıyorum oturum açma işleminden sonra 4 saniyede bir while ile istek çalıştırıyorum. ama genelde 10 12 bağlantıdan sonra ResponseError 502 hatası ve ProxyError hatası alıyorum.
    Kod ve hata kodları aşağıdaki gibi. Benim bu hataları daha az almak için kodlarda ne gibi değişiklikler yapmam lazım?

    Kod :

    login_url = "https://atm123asyon.com/login"
    user_count = 11
    def start_process():
        global iteration
        
        # Proxy ayarları
        proxies = {
            'http': 'http://12123sd3:a123sdfm12et@84.44.114.174:8080',
            'https': 'http://ah214124met:agfmet@84.44.114.174:8080',
        }
    
        print(iteration)
        while iteration < user_count:
            headers = {
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
                              'Chrome/58.0.3029.110 Safari/537.3'
            }
    
            username = "Your Email"
            password = "Your Password"
    
            retry_strategy = Retry(
                total=2,
                status_forcelist=[429, 500, 502, 503, 504],
                allowed_methods=["HEAD", "GET", "OPTIONS"],
                backoff_factor=1
            )
    
            adapter = HTTPAdapter(max_retries=retry_strategy)
            session = requests.Session()
            session.mount("https://", adapter)
            session.headers.update(headers)
            session.proxies.update(proxies)  
            requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
            
                
    
          
            try:
                response = session.get('https://atm123asyon.com', verify=False)
    
                response = session.get(login_url)
    
                if response.ok:
                    soup = BeautifulSoup(response.text, 'lxml')
                    csrf_token = soup.find('meta', {'name': 'csrf-token'})['content']
    
                    login_data = {
                        "user[email]": username,
                        "user[password]": password,
                        "token": token,
                        
                    }
    
                    response = session.post(login_url, data=login_data)
    
                    if response.ok:
                        redirect_url = "https://atm123asyon.com" + "/account"
                        response = session.get(redirect_url)
                        if response.ok:
                            soup = BeautifulSoup(response.text, 'html.parser')
                            pattern = re.compile(r'/account(\d+)/continue_actions')
                            links = soup.find_all('a', href=pattern)
    
                            if links:
                                idnumber = pattern.search(links[0]['href']).group(1)
                                payment_url = f"https://atm123asyon.com/account{idnumber}/odeme"
                                print(f"Oturum başarıyla açıldı: {username}")
                                print(payment_url)
                                return session, payment_url
    
                    else:
                        print(f"Oturum açma başarısız: {username}. Durum kodu: {response.status_code}")
                        session.close()
    
                else:
                    print(f"Oturum açma sayfasına erişilemedi: {login_url}. Durum kodu: {response.status_code}")
                    session.close()
            
            except requests.exceptions.ProxyError as e:
                print(f"Proxy hatası: {e}")
                # Burada gerekirse başka bir işlem yapılabilir
    
        return None, None
    Hata Kodları :
    HTTPSConnectionPool(host='atm123asyon.com', port=443): Max retries exceeded with url: account/53732196/odeme (Caused by ('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))


    HTTPSConnectionPool(host='atm123asyon.com', port=443): Max retries exceeded with url: account/53732196/odeme (Caused by ResponseError('too many 502 error responses'))
  • 06-01-2024, 22:10:57
    #2
    sunucu adresinde veya proxylerde sorun var
  • 06-01-2024, 22:29:55
    #3
    shms adlı üyeden alıntı: mesajı görüntüle
    sunucu adresinde veya proxylerde sorun var
    hocam ilk girişte oturum açılıyor. ama 10 12 istekten sonra bu hatayı veriyor. Bazende komut ekranı donuyor komut ekranına tıklayıp bir tuşa basınca devam ediyor. Bu donmanın sebebi sizce ne olabilir.