映画監督は権利を持っています。リクエストを使用してみてください。関数の例:
def http_get(url, user=None, password=None, proxies=None, valid_response_status[httplib.OK], **kwargs):
"""
Performs a http get over an url
@param url: the url to perfom get against
@type url: str
@param user: user if authentication required
@type user: str
@param password: password if authentication required
@type password: str
@param proxies: proxies if required
@type proxies: dict
@param valid_response_status: http response status code considered as valid
@type valid_response_status: list of int
@raise exception: if the response status code is not in valid_response_status list
"""
auth = HTTPBasicAuth(username=user, password=password)
kwargs['proxies'] = proxies
kwargs['auth'] = auth
try:
LOGGER.debug("Performing http get over : %s" % url)
_request = requests.get(url, **kwargs)
if _request.status_code not in valid_response_status:
http_error_msg = '%s Error: %s' % (_request.status_code, _request.reason)
http_error = HTTPError(http_error_msg)
http_error.response = _request
raise http_error
return _request.content
except:
LOGGER.error("Error while performing http get over : %s" % url)
raise