Python, help with retrying a request if text is found on the page

완료 등록 시간: 5년 전 착불
완료 착불

So, I have a small piece of code that will retry the request if it failed eg status code 500.

What I need in place alongside that is if a piece of text on the page is found, to also retry the request until it's successful and/or doesn't find that piece of text on the page anymore.

So in short, while this piece of code checks for status errors in the page, I need one to hopefully be implemented into this code to look for text on the page and if its found retry the same request until the text is no longer there.

Note: I need the request to always use cookies as I use the cookies to login to the site without them it won't work.

Here's the code:

headers={'Accept': 'text/html',

'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36',

'Cookie':'xxxxx=xxxxx',

}

url = 'xxxxxxxxxxxxxxxxxxxxxxxxx'

json = [login to view URL]({'xxxxx' : 'xxxxx',

'xxxxx' : 'xxxxx',

'xxxxx' : '',

'xxxxx' : 'xxxxx',

'xxxxx' : 'xxxxx',

'xxxxx' : 'xxxxx'

,'xxxxx' : 'xxxxx'

,'xxxxx' : "xxxxx'})

req = [login to view URL](url, json, headers)

retries = 1

success = False

while not success:

try:

response = [login to view URL](req)

success = True

except Exception as e:

wait = retries * 20;

print [login to view URL]("[%I:%M:%S]"), 'Failed to complete, Waiting %s seconds and re-trying...' % wait

[login to view URL]()

[login to view URL](wait)

print [login to view URL]("[%I:%M:%S]"), "Success"

Python 소프트웨어 아키텍처

프로젝트 ID: #17415199

프로젝트 소개

7 건(제안서) 재택 근무형 프로젝트 서비스 이용 중: 5년 전

수상자:

lordprasun

Looks like an easy fix.I guess 3 more lines would do it. P.s- I am Python developer with over 3 years of experience.

$15 AUD (1일 이내)
(13건의 리뷰)
3.3

이 일자리에 대한 프리랜서 7 명의 평균 입찰가: $26

yuriecojocari

I did some project with it Relevant Skills and Experience I do know a bit Proposed Milestones $35 AUD - working code

$35 AUD (1일 이내)
(4 리뷰)
2.4
Tkost

As I understand, you need to check for a certain text on the site. Relevant Skills and Experience I have experience of working with HTTP libraries. I am sure, I can help you with your project. Proposed Milestones $25 기타

$25 AUD (1일 이내)
(3 리뷰)
1.8
anandkiller143

Will do it in python or bash shell script as per ur wish Relevant Skills and Experience bash scripting, shell scripting, python scripting Proposed Milestones $35 AUD - ENd to End SOlution

$35 AUD (1일 이내)
(0 리뷰)
0.0