Python Forum
get file by proxy and header using urllib.request.urlretrieve
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get file by proxy and header using urllib.request.urlretrieve
#1
url = "https://url"

proxy = urllib.request.ProxyHandler({'https': 'https://proxy'})
opr = urllib.request.build_opener(proxy)
urllib.request.install_opener(opr)

opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla')]
urllib.request.install_opener(opener)
urllib.request.urlretrieve(url, "name")

its connecting by proxy but refuse to collect header any way to get file with both proxy and geader plz....
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  urllib can't find "parse" rjdegraff42 6 7,017 Jul-24-2023, 05:28 PM
Last Post: deanhystad
  How to keep columns header on excel without change after export data to excel file? ahmedbarbary 0 1,930 May-03-2022, 05:46 PM
Last Post: ahmedbarbary
  Insert a multiple constant value after header in csv file using python shantanu97 1 1,964 Apr-24-2022, 10:04 AM
Last Post: Pedroski55
  how can I correct the Bad Request error on my curl request tomtom 8 7,561 Oct-03-2021, 06:32 AM
Last Post: tomtom
  Prevent urllib.request from using my local proxy spacedog 0 3,913 Apr-24-2021, 08:55 PM
Last Post: spacedog
  urllib.request.ProxyHandler works with bad proxy spacedog 0 7,451 Apr-24-2021, 08:02 AM
Last Post: spacedog
  Need help with XPath using requests,time,urllib.request and BeautifulSoup spacedog 3 3,926 Apr-24-2021, 02:48 AM
Last Post: bowlofred
  Help with urllib.request Brian177 2 3,936 Apr-21-2021, 01:58 PM
Last Post: Brian177
  Request for Python code - Features extraction from JSON file (cuckoo) thinker 1 3,069 Apr-07-2021, 04:40 PM
Last Post: Larz60+
  find the header location in a .bin file without reading the whole file at a time SANJIB 0 2,994 Mar-05-2021, 04:08 PM
Last Post: SANJIB

Forum Jump:

User Panel Messages

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