Rajendra Singh
Rajendra Singh

Reputation: 97

Python requests return status code 400 on Django but without django it is working fine

I am making an Amazon Scraper and facing some kind of problem. Here is my code

def scrapedPage(self,URL, user_agent):

        
        header = {"User-Agent": user_agent, 'Accept-Encoding': 'identity', 'Server': 'Server', 'Content-Type': 'text/html', 'Accept-Ranges': 'bytes', 'Content-Encoding': 'gzip',  'Cache-Control': 'no-transform',  'Connection': 'keep-alive', 'Vary': 'Accept-Encoding' }
        proxy = {'https': proxy}
        page = requests.get(URL, headers=header, proxies=proxy)
        return page

It returns status code 400 when I use in Django framework but the same code respond 200 status code when run stand alone without Django.

Upvotes: 1

Views: 45

Answers (0)

Related Questions