Мне нужно посетить http://www.chiquitooenterprise.com/ перевернуть строку и получить доступ к веб-сайту, используя этот URL: http://www.chiquitooenterprise.com/password?code=REVERSEDSTRING
Как я могу сделать это, используя urllib2 и Python?
link = "http://www.chiquitooenterprise.com/password" request = urllib2.Request("http://www.chiquitooenterprise.com/password") contents = urllib2.urlopen(request).read() revString = request[::-1] answer = "http://www.chiquitooenterprise.com/password?code=" + revString response = urllib2.urlopen(answer) response = response.read() print(response)```
link = "http://www.chiquitooenterprise.com/password" result = requests.get("http://www.chiquitooenterprise.com/password") contents = result.text revString = contents[::-1] answer = f"http://www.chiquitooenterprise.com/password?code={revString}" response = requests.get(answer) response = response.text print(response)