as i am new to python i am expecting help the people who have experience on that. i am having problems that how to apply proxy in the following code .i mean ,i wan to apply proxy in order to execute the following source code(the following source code is working without proxy ) Ref:https://pypi.python.org/pypi/sumy
<code>
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from sumy.parsers.html import HtmlParser
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa import LsaSummarizer as Summarizer
from sumy.nlp.stemmers import Stemmer
from sumy.utils import get_stop_words
LANGUAGE = "czech"
SENTENCES_COUNT = 10
if __name__ == "__main__":
url = "http://www.zsstritezuct.estranky.cz/clanky/predmety/cteni/jak-naucit-dite-spravne-cist.html"
parser = HtmlParser.from_url(url, Tokenizer(LANGUAGE))
# or for plain text files
# parser = PlaintextParser.from_file("document.txt", Tokenizer(LANGUAGE))
stemmer = Stemmer(LANGUAGE)
summarizer = Summarizer(stemmer)
summarizer.stop_words = get_stop_words(LANGUAGE)
for sentence in summarizer(parser.document, SENTENCES_COUNT):
print(sentence)
</code>
For an example with a working source code that how to apply proxy
ex:
<code>
HTTP_PROXY = {
"http": "xxx.xxx.xxx.xxx:8800",
"https": "xxx.xxx.xxx.xxx:8800",
}
fetch = requests.get("http://www.independent.co.uk/news/uk/politics/barack-obama-says-david-cameron-allowed-libya-to-become-a-s-show-a6923976.html", proxies=HTTP_PROXY)
proxy_lookup = requests.get("https://httpbin.org/ip", proxies=HTTP_PROXY)
html = BeautifulSoup(fetch.content, 'html.parser') #full content # lxml
meta_title = html.title.string
</code>
Thanks in advance