Open bonham opened 4 years ago
did you find a workaround? yes i see this is old. if i should be somewhere else, then set me in the right direction.
You need to use cookiejar from future instead, like this:
import future.backports.http.cookiejar as http_cookiejar
I got this AttributeError as well, and I realized the error was that I was instantiating my HTTPCookieProcessor with a http.cookiejar.CookieJar object (the default is future.backports.http.cookiejar). To fix it, I switched from http.cookiejar to future.backports.http.cookiejar.
i.e. old code:
from future import standard_library
standard_library.install_aliases()
import urllib.request
import http.cookiejar
http_cookie_processor = urllib.request.HTTPCookieProcessor(http.cookiejar.CookieJar())
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
new code:
from future import standard_library
standard_library.install_aliases()
import urllib.request
import future.backports.http.cookiejar as http_cookiejar
http_cookie_processor = urllib.request.HTTPCookieProcessor(http_cookiejar.CookieJar())
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
Run this example with future 0.18.2 and python 2.7.16 to reproduceStack Trace:
Tested on debian 10.2 in docker