K
K
KingServers2018-10-02 17:48:15
Python
KingServers, 2018-10-02 17:48:15

Google through proxy through Python?

Python script, super simple

import logging
logging.basicConfig(level=logging.DEBUG)

from grab import Grab
from pprint import pprint

g = Grab()g.setup(   connect_timeout=10,   timeout=10,   proxy="142.193.116.100:7738",
   proxy_type='socks5',
   user_agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'
)

url = 'https://www.google.com/'
g.go(url)
print(g.doc.url)
pprint(g.doc.body)

Google gives a 400 error through a proxy, but other sites work.
If you insert a proxy in the browser, then everything is ok, everything is ok through the curl too.
Checked with a user agent from a python, it also does not enter.
Where could the problem be?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question