What is robots.txt, why respect it, and consequences of ignoring it?
Your grasp of ethical and legal guardrails in data collection.
It disallows crawler paths via the Robots Exclusion Protocol; honoring it prevents server strain, legal risk, and broken trust.
Calling it optional.
What's really being asked
This question checks whether a candidate sees web scraping as more than a technical exercise. Interviewers want to know if you understand the Robots Exclusion Protocol, server etiquette, and the legal and ethical boundaries around automated data collection. At the senior level, they expect you to discuss liability, operational impact, and how to build scrapers that respect external systems.
The full answer
First, define robots.txt as a file that uses the Robots Exclusion Protocol to tell crawlers which portions of a website they are allowed to visit. Second, explain that respecting it matters for three reasons in order: it prevents unnecessary server load and bandwidth costs for the target site; it reduces legal risk because ignoring directives can violate laws like the Computer Fraud and Abuse Act or terms of service; and it preserves professional trust and your own infrastructure since violators often get IP blocked. Third, mention concrete consequences such as rate limiting, permanent bans, cease-and-desist letters, or litigation. Fourth, note that robots.txt is a courtesy standard and not a hard security boundary, so a well-designed scraper should also check response codes and implement polite rate limiting regardless of what the file says.
The mistakes people make
A major red flag is claiming that robots.txt is irrelevant because the data is public or because the file lacks legal enforcement everywhere. Another weak response is saying the file is a security mechanism that hides sensitive data; it does not hide anything, it only requests polite behavior. Candidates who admit to ignoring it in past projects without discussing risk mitigation also signal poor judgment. Finally, confusing robots.txt with an allowlist rather than a disallow list shows a lack of familiarity with the standard.
What usually comes next
The interviewer may ask how you would handle a site that has no robots.txt file, how you implement rate limiting in practice, or whether you have ever faced a legal challenge related to scraping. They might also ask how you would scrape ethically if robots.txt blocks the exact data you need for a business-critical project, probing your ability to negotiate API access or find alternative data sources.
A concrete example
Suppose you are building a price-monitoring scraper for an e-commerce site. You check robots.txt and see that the Disallow directive covers the product detail path. A good answer means you stop crawling that path, reduce your request rate to one page every few seconds on allowed paths, and reach out to the site for a data partnership or API key. Ignoring the directive would likely trigger a Cloudflare block within hours, cost the site money in compute and bandwidth, and expose your company to a CFAA lawsuit or a cease-and-desist letter.
Interview question
Why is it important for a scraper to follow robots.txt directives on a publicly accessible website?
- a.Because ignoring it can lead to IP bans, legal liability, and unnecessary server load for the target siteCorrect
- b.Because it grants explicit crawling permission for every URL listed in the file
- c.Because the file acts as a security gate that hides sensitive pages from all users
- d.Because public websites automatically waive bandwidth costs and terms of service for automated crawlers
Why? this is the answer
Ignoring robots.txt risks IP bans, legal action under laws like the CFAA, and added server costs for the target site. The most tempting distractor wrongly treats the file as a security boundary that hides pages, but it only requests polite crawler behavior and does not actually restrict access.
Just read this? Test yourself on what you have been reading.
Read the original → en.wikipedia.org
- #web scraping
- #robots.txt
- #data ethics
- #legal compliance
- #interview prep
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles