7

I'm trying to make a HTTP request but the website that I currently can reach from my Firefox browser response 503 error. Code itself is really simple. After some search in the net I added user-Agent parameter to request but it didn't help either. Can someone explain me how to get rid of this 503 error? Btw I want to make my own alert system based on prices of btc.

import requests

url = "https://www.paribu.com"
header ={'User-Agent': 'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0 '}


response = requests.get(url,headers = header)
print(response)
payne
  • 13,833
  • 5
  • 42
  • 49
erondem
  • 482
  • 1
  • 11
  • 24
  • 1
    503 is service unavailable. In this case, it looks like the web page has a buffer screen which prevents you from scraping – usernamenotfound Dec 20 '17 at 17:04
  • 503 appeared on my first try. So I assume they didn't put me on the blacklist, I think as you said they blocked web scraping somehow. – erondem Dec 20 '17 at 17:11
  • I have the same issue. Using curl works fine, requests from Java and Chrome also work fine. So I think there is an issue in requests module. – Sergei Vasilenko Mar 04 '18 at 06:18

3 Answers3

13

I had the same problem. Use this in your code.

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',}
r = requests.post(url, headers=headers)
r.raise_for_status()

Found from Reddit's /r/learnpython subreddit

TylerH
  • 20,799
  • 66
  • 75
  • 101
tsadigov
  • 153
  • 1
  • 7
-2

503 means the server is overloaded: https://httpstatuses.com/503

This is not an issue with your code, it is an issue with the server you are trying to access.

Pwnosaurus
  • 2,058
  • 1
  • 19
  • 21
-3

Status code 503 means that the server is down for maintenance. Just try again later.