iojw / socialscan

Python library for accurately querying username and email usage on online platforms
Mozilla Public License 2.0
1.44k stars 186 forks source link

TypeError: _request() got an unexpected keyword argument 'cookies' #4

Closed brandonpaiz closed 5 years ago

brandonpaiz commented 5 years ago

I get the following when trying to run socialscan username-2

 27%|████████▍                      | 3/11 [0.19s]SSL error in data received
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f4e2ca5a1d0>
transport: <_SelectorSocketTransport fd=11 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 207, in feed_ssldata
    self._sslobj.unwrap()
  File "/usr/lib/python3.7/ssl.py", line 767, in unwrap
    return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2592)
Traceback (most recent call last):                
  File "/usr/bin/socialscan", line 11, in <module>
    load_entry_point('socialscan==0.1.1', 'console_scripts', 'socialscan')()
  File "/usr/lib/python3.7/site-packages/socialscan/__main__.py", line 7, in main
    asyncio.run(cli.main())
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 573, in run_until_complete
    return future.result()
  File "/usr/lib/python3.7/site-packages/socialscan/cli.py", line 87, in main
    platform_response = await future
  File "/usr/lib/python3.7/asyncio/tasks.py", line 533, in _wait_for_one
    return f.result()  # May raise f.exception().
  File "/usr/lib/python3.7/site-packages/socialscan/util.py", line 31, in query
    response = await checkers[platform].check_username(query_str)
  File "/usr/lib/python3.7/site-packages/socialscan/platforms.py", line 237, in check_username
    cookies=cookies) as r:
  File "/usr/lib/python3.7/site-packages/socialscan/platforms.py", line 107, in post
    return self._request("POST", url, **kwargs)
  File "/usr/lib/python3.7/site-packages/socialscan/platforms.py", line 104, in _request
    return self.session.request(method, url, timeout=self.client_timeout, proxy=proxy, **kwargs)
  File "/usr/lib/python3.7/site-packages/aiohttp/client.py", line 223, in request
    return _RequestContextManager(self._request(method, url, **kwargs))
TypeError: _request() got an unexpected keyword argument 'cookies'
iojw commented 5 years ago

Hi, this looks like a existing bug in aiohttp (https://github.com/aio-libs/aiohttp/issues/3477) which still occurs for some.

What version of aiohttp and Python are you on?

brandonpaiz commented 5 years ago

Hey thanks for getting back so quickly. I upgraded aiohttp from 3.4.4 to 3.5.4 which helped a bit. Now running the same command with Python 3.7.1 on Arch Linux (coloration matches demo):

55%|████████████████▉              | 6/11 [0.36s]SSL error in data received
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fe18f669ac8>
transport: <_SelectorSocketTransport fd=10 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 207, in feed_ssldata
    self._sslobj.unwrap()
  File "/usr/lib/python3.7/ssl.py", line 767, in unwrap
    return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2592)
----------------------------------------          
               username-2
----------------------------------------
GitLab
Lastfm
Pastebin
GitHub
Reddit
Snapchat
Tumblr
Instagram: Usernames can only use letters, numbers, underscores and periods.
Twitter: Your username can only contain letters, numbers and '_'

Available, Taken/Reserved, Invalid, Error
Completed 9 queries in 1.36s
iojw commented 5 years ago

It looks like you were initially facing 2 bugs. The first error (TypeError: _request() got an unexpected keyword argument 'cookies') was due to a feature added in aiohttp v3.5 so you updating fixed that issue.

As for the second error (ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2592)) it appears to be a current bug in aiohttp as seen in the linked issue above so you'll have to wait for a corresponding fix in that repo.

iojw commented 5 years ago

@brandonpaiz Looking at the linked issue this problem should be fixed in Python 3.7.4. I’ll close this issue for now, let me know if it still occurs.