rishatik92 / ya_ma

UNOFFICIAL Client for the REST API of Yandex Transport
MIT License
1 stars 1 forks source link

Yandex blocks requests from this library #2

Open airens opened 5 years ago

airens commented 5 years ago

After implementing the component "yandex_transport" in Home Assistant (which uses this library) Yandex started to block requests where library trying to get CSRF_TOKEN_KEY and other info. It just returns page with text "Нам очень жаль, но запросы, поступившие с вашего IP-адреса, похожи на автоматические", so library chashing on string 91:

Traceback (most recent call last): File "D:\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda3\lib\site-packages\ya_ma.py", line 119, in CLIENT = YandexMapsRequester() File "D:\Anaconda3\lib\site-packages\ya_ma.py", line 55, in init self.set_new_session() File "D:\Anaconda3\lib\site-packages\ya_ma.py", line 91, in set_new_session rf'"{SESSION_KEY}":"(\d+.\d+)"', reply AttributeError: 'NoneType' object has no attribute 'group'

rishatik92 commented 5 years ago

Hi, this problem is fixes after one-two days in silent. Try to send request again after one day. Another thing that if you will send this requests with big frequency, yandex will block your requests.

maybe need to add yandex autorization, because when you autorized - yandex not blocking your requests. or maybe add function using autorized cookies. How are you thinking? @airens