Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Opening a url with a proxy

first of, I'm fairly new to python so dont judge me please.
Questions -

[+] I already know how to open a url/link with python. But i want the link to run a proxy automaticly once i run the script. How?
[+] Is it even possible?


Code
#! /usr/bin/env python

import colored
from colored import stylize
import webbrowser

Continue = ''


# print(stylize('This is green', colored.fg('green')))


print('Welcome to this complex port scanner')
Continue = raw_input(('(') + stylize('+', colored.fg('green')) + (') Enter Website : '))
if Continue == Continue:
       webbrowser.open(Continue)
You can use the 'requests' library with the proxy argument.
Code
import requests
proxies = {
   'http':'http://1.2.3.4:80',
   'https':'https://1.2.3.4:80'
}

requests.get('http://google.com', proxies=proxies)
(Jun 9, 2019 01:14 AM)Lynx Wrote:  You can use the 'requests' library with the proxy argument.
Code
import requests
proxies = {
  'http':'http://1.2.3.4:80',
  'https':'https://1.2.3.4:80'
}

requests.get('http://google.com', proxies=proxies)

I would have to change the webbrowser.open to requests.get('http://google.com', proxies=proxies). right?
(Jun 9, 2019 01:20 AM)pms Wrote:  I would have to change the webbrowser.open to requests.get('http://google.com', proxies=proxies). right?

Yes. Also, if you want to get the response, you can use this:

r = requests.get('http://google.com', proxies=proxies)
print(r.text)
(Jun 9, 2019 01:25 AM)Lynx Wrote:  Yes. Also, if you want to get the response, you can use this:

r = requests.get('http://google.com', proxies=proxies)
print(r.text)

Got it, thank you for the help !


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by PatchzDexJun 28, 2020 10:24 AM 2 118 Jun 28, 2020 10:24 AM
Last Post: PatchzDex
[.NET] by EndaxOct 22, 2016 04:17 AM 47 5,617 Oct 22, 2016 04:17 AM
Last Post: Liquir
[.NET] by AρεϰJun 23, 2015 09:10 AM 18 361 Jun 23, 2015 09:10 AM
Last Post: VmX5