Skip to content

Create a ping function to verify url validity #9

@jrkong

Description

@jrkong

pySearch currently creates and opens links that may not exist. For example, current behavior defaults the domain to .ca however there is a chance that the domain is unsupported by the search engine (consider http://stackoverflow.ca/search?q=test.

In these cases the script should give the user a message stating that the built link is invalid. After this the code should try different popular domain extensions to see if any work. If a valid domain extension exists then provide a message which informs the user of the found domain and opens the link in the browser.

I believe the most lightweight solution would be a calling ping to the subsystem shell using os.system() subprocess (instructions on replacing os.system()/example here). In theory a successful ping should return error code 0 and all other returns should signify an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions