Python Forum
user validation for opening urls
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
user validation for opening urls
#1
HI All,

I' mlearning python and writing few programs to automate my testing. I am trying to do url validation based on what user has entered.If user inputs the version as 21.1.0 then I should be able to search for 21.1.10 in the base_url and if match found then only open the link. I'm struggling to find the match with the version user enters.
If I enter 1.1.0 it scans the website for 1.1.0 and if there's 21.1.0, it finds the match and prints vresion found. I want if it matches only with 21.1.0 then only open the link or if user enters 2.2.0 and there's 2.2.0 then I should find the match for 2.2.0 and not for 12.2.0.
Please note this is not the correct base_url.

import urllib2
import re
base_url = "http://artifactory.int.abc.com:9090/artifactory/simple/test-local/com/abc/test/test.far/"
user_input = raw_input("Enter the test version you want to upgrade to: ")

#connect to a URL
website = urllib2.urlopen(base_url)

#read html code
html = website.read()
print(html)

test2 = re.search(user_input, html)
if user_input in html:
    print("version found")
else:
    print("version not found")
Reply


Messages In This Thread
user validation for opening urls - by Ashley - Jun-10-2019, 07:19 PM
RE: user validation for opening urls - by metulburr - Jun-16-2019, 04:43 PM
RE: user validation for opening urls - by Ashley - Jul-06-2019, 04:59 AM
RE: user validation for opening urls - by perfringo - Jul-06-2019, 05:40 AM
RE: user validation for opening urls - by Ashley - Jul-08-2019, 07:31 PM
RE: user validation for opening urls - by metulburr - Jul-08-2019, 09:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Python to search through a list of urls jeremy 4 2,924 Dec-18-2019, 11:52 AM
Last Post: Malt
  Urls in a file to be executed pyseeker 2 2,085 Sep-09-2019, 03:38 PM
Last Post: pyseeker
  opening a file from a windows desktop folder- error opening file Charan007 1 3,020 Dec-06-2018, 11:50 AM
Last Post: buran
  Looping URLs breaks them PythonStudent 2 2,973 Apr-21-2018, 02:54 PM
Last Post: PythonStudent
  listening to user input even after opening an application in mac sharma16aug 4 5,018 Jan-24-2017, 10:43 AM
Last Post: sharma16aug

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020