jtriley / pystun

A Python STUN client for getting NAT type and external IP
https://github.com/jtriley/pystun
MIT License
435 stars 154 forks source link

KeyError: b'0101' issue in Python 3.5 #22

Open vyassu opened 7 years ago

vyassu commented 7 years ago

Hi

I am encountering below mentioned error after applying the fix for Issue #21.

nat_type, external_ip, external_port = stun.get_ip_info(stun_host=(stun_details[0]), stun_port=int(stun_details[1])) File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\stun__init.py", line 253, in get_ip_info stun_host=stun_host, stun_port=stun_port) File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\stun\init.py", line 191, in get_nat_type ret = stun_test(s, stun_host, port, source_ip, source_port) File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\stun\init__.py", line 136, in stun_test bind_resp_msg = dictValToMsgType[msgtype] == "BindResponseMsg" KeyError: b'0101'

aarant commented 6 years ago

Since the pull requests fixing this project for Python 3 have been open for a long time, I decided to make my own version of this project. It may be useful to you: https://github.com/arantonitis/pynat

PopMini commented 5 months ago

Fixed bug:

bind_resp_msg = dictValToMsgType[msgtype.decode()] == "BindResponseMsg"