Python Forum
Installing and running a python web scraping app from github to a windows 8.1 system
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installing and running a python web scraping app from github to a windows 8.1 system
#17
Some sites require you to provide a header (user-agent) in your request, and may refuse your connection otherwise.
you can find your user-agent by googleing 'my user agent', it will appear at top of page,
then set up in dictionary like:
user_agent = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) '
    'Gecko/20100101 Firefox/60.0 AppleWebKit/537.36 (KHTML, '
    'like Gecko)  Chrome/68.0.3440.75 Safari/537.36'}
don't know what you are using to get page, but with requests it would be:
response = requests.get(url, headers=user_agent)
Also make sure you are sleeping for a few seconds after each request as hammering on a site is another reason for refusal.
from time import sleep
...
response = requests.get(url, headers=user_agent)
sleep(2)
Reply


Messages In This Thread
RE: Installing and running a python web scraping app from github to a windows 8.1 system - by Larz60+ - Oct-04-2018, 11:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing Github-programs AudunNilsen 1 324 Mar-22-2024, 04:28 PM
Last Post: deanhystad
  Advice for installing python app from github ? Adi44 6 1,425 Aug-07-2023, 06:34 PM
Last Post: snippsat
  Python script running under windows over nssm.exe JaroslavZ 0 810 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  Installing Qt for Python. (On Windows 10) davediamond 22 5,084 Apr-18-2022, 06:50 AM
Last Post: ndc85430
  batch file for running python scipt in Windows shell MaartenRo 2 2,060 Jan-21-2022, 02:36 PM
Last Post: MaartenRo
  Installing auto-sklearn on Windows 10 Led_Zeppelin 1 2,766 Apr-15-2021, 08:02 PM
Last Post: bowlofred
  Need help installing infoblox-client on Windows 10 dazmac10 1 2,613 Mar-07-2021, 10:57 PM
Last Post: snippsat
  How to link Sublime Text 3 Build system to Python 3.9 Using Windows 10 Fanman001 2 4,783 Mar-04-2021, 03:09 PM
Last Post: martpogs
  Running python scripts from github etc pacmyc 7 3,870 Mar-03-2021, 10:26 PM
Last Post: pacmyc
  Difference between os.system("clear") and os.system("cls") chmsrohit 7 16,919 Jan-11-2021, 06:30 PM
Last Post: ykumar34

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020