How to Generate Sitemap using Python ?

In this tutorial i’m going to learn how to generate sitematap using python. I have described in very easy and generate the sitemap where user put url then crawl all website url.

Read this -> Python Installation

Run below package for generate the sitemap

pip install sitemap-generator

Next to create app.py file and put below code

import sys
import logging
from pysitemap import crawler
if __name__ == "__main__":
    if "--iocp" in sys.argv:
        from asyncio import events, windows_events
        sys.argv.remove('--iocp')
        logging.info('using iocp')
        el = windows_events.ProactorEventLoop()
        events.set_event_loop(el)
    # root_url = sys.argv[1]
    root_url = 'https://www.edureka.co'
    crawler(root_url, out_file='sitemap.xml')

Next to create this file name

sitemap.xml
Next to run below command in cmd
python app.py

Now its crawling succesfully.

Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

How to call css file in flask ?

In this tutorial we’re going to learn how to call the external file of css in html file. I have mentioned in very easy way so follow…

How to check County Alternative name check in Python ?

In this tuturial we have to learn how to check any country alternative name in python. I have mentioned in very easy way to find the any…

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

when i run below code showing error :- Error:- Solution:-

How to check any country Information using Python ?

In this tutorial I’m going to learn how to check any country information using python. So follow this tutorial in this tutorial I have mentioned in very…

How to check any Country alternative names using Python ?

In this tutorial I’m going to learn how to check any country alternative name using python. So follow this tutorial in this tutorial I have mentioned in…

How to install python on windows ? Hello word print in Python ?

In this tutorial I’m going to install python on windows and also run hellow word in python, so follow this video in this I have demonstrate in…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x