开发者

How to use a proxy in python and twisted to get a page

开发者 https://www.devze.com 2023-04-08 15:29 出处:网络
开发者_Python百科Is it true that if you have a proxy such ashttp://222.126.99.99:8909 that you can access a url from the browser e.g. www.cnn.com as http://222.126.99.99:8909/www.cnn.com.
开发者_Python百科

Is it true that if you have a proxy such as http://222.126.99.99:8909 that you can access a url from the browser e.g. www.cnn.com as http://222.126.99.99:8909/www.cnn.com.

Is this is true, from twisted can I use the proxy to get a page as follows?

iUrl=http://222.126.99.99:8909/www.cnn.com
client.getPage(iUrl,method='GET').addCallback(self.processPage,iUrl).addErrback(self.printError,iUrl)


if the proxy requires a username and password..how do I do modify the URL to use the credentials?

The format is:

url = 'http://username:password@host:port/path'

Though it is deprecated.

Note, it is not safe to send your username and password over http.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号