mirror of
https://github.com/soimort/you-get.git
synced 2025-01-24 22:15:03 +03:00
commit
8bddd170f3
@ -257,6 +257,7 @@ def undeflate(data):
|
|||||||
# DEPRECATED in favor of get_content()
|
# DEPRECATED in favor of get_content()
|
||||||
def get_response(url, faker = False):
|
def get_response(url, faker = False):
|
||||||
logging.debug('get_response: %s' % url)
|
logging.debug('get_response: %s' % url)
|
||||||
|
url = parse.quote(url, ':/')
|
||||||
|
|
||||||
# install cookies
|
# install cookies
|
||||||
if cookies:
|
if cookies:
|
||||||
@ -279,6 +280,7 @@ def get_response(url, faker = False):
|
|||||||
# DEPRECATED in favor of get_content()
|
# DEPRECATED in favor of get_content()
|
||||||
def get_html(url, encoding = None, faker = False):
|
def get_html(url, encoding = None, faker = False):
|
||||||
logging.debug('get_html: %s' % url)
|
logging.debug('get_html: %s' % url)
|
||||||
|
url = parse.quote(url, ':/')
|
||||||
|
|
||||||
content = get_response(url, faker).data
|
content = get_response(url, faker).data
|
||||||
return str(content, 'utf-8', 'ignore')
|
return str(content, 'utf-8', 'ignore')
|
||||||
@ -286,6 +288,7 @@ def get_html(url, encoding = None, faker = False):
|
|||||||
# DEPRECATED in favor of get_content()
|
# DEPRECATED in favor of get_content()
|
||||||
def get_decoded_html(url, faker = False):
|
def get_decoded_html(url, faker = False):
|
||||||
logging.debug('get_decoded_html: %s' % url)
|
logging.debug('get_decoded_html: %s' % url)
|
||||||
|
url = parse.quote(url, ':/')
|
||||||
|
|
||||||
response = get_response(url, faker)
|
response = get_response(url, faker)
|
||||||
data = response.data
|
data = response.data
|
||||||
@ -297,6 +300,7 @@ def get_decoded_html(url, faker = False):
|
|||||||
|
|
||||||
def get_location(url):
|
def get_location(url):
|
||||||
logging.debug('get_location: %s' % url)
|
logging.debug('get_location: %s' % url)
|
||||||
|
url = parse.quote(url, ':/')
|
||||||
|
|
||||||
response = request.urlopen(url)
|
response = request.urlopen(url)
|
||||||
# urllib will follow redirections and it's too much code to tell urllib
|
# urllib will follow redirections and it's too much code to tell urllib
|
||||||
@ -323,6 +327,7 @@ def get_content(url, headers={}, decoded=True):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
logging.debug('get_content: %s' % url)
|
logging.debug('get_content: %s' % url)
|
||||||
|
url = parse.quote(url, ':/')
|
||||||
|
|
||||||
req = request.Request(url, headers=headers)
|
req = request.Request(url, headers=headers)
|
||||||
if cookies:
|
if cookies:
|
||||||
@ -362,6 +367,7 @@ def post_content(url, headers={}, post_data={}, decoded=True):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
logging.debug('post_content: %s \n post_data: %s' % (url, post_data))
|
logging.debug('post_content: %s \n post_data: %s' % (url, post_data))
|
||||||
|
url = parse.quote(url, ':/')
|
||||||
|
|
||||||
req = request.Request(url, headers=headers)
|
req = request.Request(url, headers=headers)
|
||||||
if cookies:
|
if cookies:
|
||||||
|
Loading…
Reference in New Issue
Block a user