0

i am trying to get lowest prices for video games from https://www.g2a.com i got Access Denied response . I already tried add different user agents and different ip and did not succeed

from bs4 import BeautifulSoup
import requests
import ssl
import urllib.request, urllib.parse, urllib.error




url_siemens_part = 'https://www.g2a.com/search?query=cyberpank'

with requests.session() as sr:
    sr.headers.update({'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0'})
    partUrl = sr.get(url_siemens_part)
    soup = BeautifulSoup(partUrl.content,'html.parser')
    print(soup)

response:

<html><head>
<title>Access Denied</title>
</head><body>
<h1>Access Denied</h1>
 
You don't have permission to access "http://www.g2a.com/search?" on this server.<p>
Reference #18.2d6533b8.1611493251.269dd254
</p></body>
</html>

its not duplicate , 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0','Accept-Language': 'en-US,en;q=0.5' as headers does not works

  • Try checking the answers at https://stackoverflow.com/questions/41982475/scraper-in-python-gives-access-denied if they help – Eagle Jan 24 '21 at 13:13
  • And https://stackoverflow.com/questions/62354101/how-can-i-access-this-type-of-site-using-requests?noredirect=1&lq=1 This is using the same website as yours – Eagle Jan 24 '21 at 13:14
  • 3
    Does this answer your question? [How can I access this type of site using requests?](https://stackoverflow.com/questions/62354101/how-can-i-access-this-type-of-site-using-requests) – Samsul Islam Jan 24 '21 at 14:19
  • its not worked not with user agent nor with Accept-Language – stievendedal Jan 25 '21 at 07:54

0 Answers0