Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3.8 error: TypeError: unsupported operand type(s) for *: 'OpenerDirector' and 'int' #313

Open
mahesh557 opened this issue Jul 26, 2021 · 0 comments

Comments

@mahesh557
Copy link

mahesh557 commented Jul 26, 2021

HI,

Getting below error in python3.8.
Can you please help fix this.

  File "/Volumes/Macintosh HD - Data/ContentDev/MySOAR/venv/lib/python3.8/site-packages/ipwhois/asn.py", line 455, in lookup
    self._net.dns_resolver.timeout * (
TypeError: unsupported operand type(s) for *: 'OpenerDirector' and 'int'

My Code

    import urllib
    from ipwhois import IPWhois

    proxies = get_systemproxy()                #return proxy dict{'http': .., 'https':...}
    proxy_url = proxies.get('https') if proxies.get('https') else proxies.get('http')
    if proxy_url != '':
        proxy_handler = urllib.request.ProxyHandler(proxies)
        proxy_opener =  urllib.request.build_opener(proxy_handler)
        ip_obj = IPWhois(ip, proxy_opener)
    else:
        ip_obj = IPWhois(ip)

    results = ip_obj.lookup_rdap(depth=1)

Problem at /ipwhois/asn.py line 455, is
self._net.dns_resolver.timeout is of type OpenerDirector instead of float/int

                    self._net.dns_resolver.lifetime = (
                        self._net.dns_resolver.timeout * (
                            retry_count and retry_count or 1
                        )
                    )
@mahesh557 mahesh557 changed the title Failing with below error in python 3.8 python 3.8 error: TypeError: unsupported operand type(s) for *: 'OpenerDirector' and 'int' Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant