Created
March 12, 2019 19:15
-
-
Save hamletbatista/65247c49050914558c35e1a8e06da443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#convert relative URLs to absolute | |
from urllib.parse import urljoin | |
#relative 404 URLs from Search Console API: webmasters.urlcrawlerrorssamples.list | |
pageUrl = "product/mad-for-plaid-flannel-dress" #missing forward slash | |
print(urljoin("https://www.example.com/", pageUrl)) | |
#Output -> https://www.example.com/product/mad-for-plaid-flannel-dress | |
#relative links from Google Analytics API: ga:landingPagePath | |
landingPagePath = "/about-chc/clinicians/audiology-technology/" #including forward slash | |
print(urljoin("https://www.example.com/", landingPagePath)) | |
#Output -> https://www.example.com/about-chc/clinicians/audiology-technology/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment