Skip to main content

Parse robots.txt

Project description

robotsparsetools

robots.txt is important when crawling website

This module will help you parse robots.txt

Install

$ pip install robotsparsetools

Usage

Parse

Please create an Parse instance first

from robotsparsetools import Parse

url = "URL of robots.txt you want to parse"
p = Parse(url) # Create an instance. Returns a Parse class with the useragent as the key

# Get allow list
p.Allow(useragent)

# Get disallow list
p.Disallow(useragent)

# Get value of Crawl-delay(Return value is int or None)
p.delay(useragent)

# Find out if crawls are allowed
p.can_crawl(url, useragent)

If no useragent is specified, the value of '*' will be referenced

Also, since the Parse class inherits from dict, you can also use it like dict

from robotsparsetools import Parse

p = Parse(url)
p["*"]
p.get("*") # Can also use get method

Error Classes

Also, there are two error classes

from robotsparsetools import NotURLError, NotFoundError

License

This program's license is MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotsparsetools-1.2.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotsparsetools-1.2.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file robotsparsetools-1.2.1.tar.gz.

File metadata

  • Download URL: robotsparsetools-1.2.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.7

File hashes

Hashes for robotsparsetools-1.2.1.tar.gz
Algorithm Hash digest
SHA256 cd7e74e6aa0dd2fab49f7949cc195f69737f0ee6adf5a7d78a4b56b92c66a77f
MD5 1130a04d4e94dd1437b553cfcb3fc52f
BLAKE2b-256 e9414f4ea82a32998b7b7058658345863a3e7967702a887e85cd9f34dbaf30a4

See more details on using hashes here.

File details

Details for the file robotsparsetools-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: robotsparsetools-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.7

File hashes

Hashes for robotsparsetools-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f625d209b387d0234f830b8ff71e9a1854b464c4d5f5b7b5eaa3b64fed1120ac
MD5 ac9e136ad73d919f220769ee766dec80
BLAKE2b-256 00e8ed9baa7f45dd980e157b6c4f1dae7436800264ebc64f341eb19486cebfe2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page