import webbrowser
import random
idr = random.randint(10000, 9999999)
link = 'view&id='
webbrowser.open(link,idr)
with this code it generates the id and puts it at the end of the link as an id for an image however i have found that it wont work as it puts a space between the links = and the id