I would like to programatically generate a URL made by these parts
Fixed part
https://booking.snav.it/#/booking/rates/
Outbound route number - changes
1040
Outbound date - changes
19-02-2019
Inbound route number - changes
1042
Inbound date - changes
20-02-2019
Parameters:
"adults": "1"
"childs":"0"
"infants":"0"
"res": "0"
"vehicle":"0"
Output
https://booking.snav.it/#/booking/rates/1040/19-02-2019/1042/19-02-2019?adults=1&childs=0&infants=0&res=0&vehicle=0
I know how to pass parameters with urllib.parse.urlencode
params = urllib.parse.urlencode({
"adults": "1"
"childs":"0"
"infants":"0"
"res": "0"
"vehicle":"0"
})
url = "https://booking.snav.it/#/booking/rates/"
res = requests.get(url, params=params)
but don't know how to build dynamically the first part after the fixed URL 1040/19-02-2019/1042/19-02-2019