<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: OYINKANSOLA BAKARE AMINAT</title>
    <description>The latest articles on DEV Community by OYINKANSOLA BAKARE AMINAT (@oyinkansola_bakareaminat).</description>
    <link>https://dev.to/oyinkansola_bakareaminat</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4176131%2F8bf145f5-4fed-49f3-8039-aa815a171548.jpeg</url>
      <title>DEV Community: OYINKANSOLA BAKARE AMINAT</title>
      <link>https://dev.to/oyinkansola_bakareaminat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oyinkansola_bakareaminat"/>
    <language>en</language>
    <item>
      <title>Web Scraping for Beginners: How to Collect Data Politely and Avoid Getting Blocked</title>
      <dc:creator>OYINKANSOLA BAKARE AMINAT</dc:creator>
      <pubDate>Mon, 12 Oct 2026 01:10:33 +0000</pubDate>
      <link>https://dev.to/oyinkansola_bakareaminat/web-scraping-for-beginners-how-to-collect-data-politely-and-avoid-getting-blocked-1034</link>
      <guid>https://dev.to/oyinkansola_bakareaminat/web-scraping-for-beginners-how-to-collect-data-politely-and-avoid-getting-blocked-1034</guid>
      <description>&lt;p&gt;When people first hear about web scraping, they often think it's some kind of hacking. It isn't. Scraping just means letting a small program read a web page and pick out the parts you want, like prices, headlines, or job titles, so you don't have to copy them by hand.&lt;/p&gt;

&lt;p&gt;The part that trips up most newcomers is getting blocked. You run your script a few times and suddenly the site stops answering. That usually happens because the script behaved in a way no normal visitor would. The good news is that most blocks are easy to avoid.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read the rules before you start
&lt;/h2&gt;

&lt;p&gt;Type the site's address followed by &lt;code&gt;/robots.txt&lt;/code&gt; in your browser (for example &lt;code&gt;website.com/robots.txt&lt;/code&gt;). This file tells automated tools which pages they may visit. If a page is off limits, leave it alone. It's also worth skimming the site's terms of service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check for an API first
&lt;/h2&gt;

&lt;p&gt;Many sites already share their data through an official API. It's cleaner, it's allowed, and it can save you from writing a scraper at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't rush the site
&lt;/h2&gt;

&lt;p&gt;A script can send hundreds of requests in a few seconds, and to a server that looks like an attack. A pause of a second or two between requests is usually enough to avoid trouble.&lt;/p&gt;

&lt;h2&gt;
  
  
  Say who you are
&lt;/h2&gt;

&lt;p&gt;Add a User-Agent with a name for your project and a contact email. It's honest, and site owners tend to be more relaxed about visitors who introduce themselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small example in Python
&lt;/h2&gt;

&lt;p&gt;Here's a short script that puts these habits together. You'll need to install two libraries first: &lt;code&gt;pip install requests beautifulsoup4&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;bs4&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BeautifulSoup&lt;/span&gt;

&lt;span class="n"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User-Agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MyLearningBot/1.0 (contact: you@email.com)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;urls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com/page1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com/page2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;soup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;BeautifulSoup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;html.parser&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;soup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# wait 2 seconds between requests
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What to do if you get a 429 error
&lt;/h2&gt;

&lt;p&gt;A 429 means "too many requests." Stop, wait a while, and slow your script down. Pushing through usually makes things worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick word on proxies
&lt;/h2&gt;

&lt;p&gt;You'll see proxies mentioned a lot in scraping communities. They send your requests through different addresses, and they have real uses in large, legitimate projects. But they are not a way to ignore a site's rules, and a beginner doesn't need one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Stick to public data, keep your speed low, and never collect personal information. Scraping politely keeps you out of trouble and keeps the web usable for everyone.&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>python</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
