كيف تضيع الكثير من الوقت على نص صغير أو تاريخ طلب سحب واحد

مع هذه الملاحظة ، أود أن أظهر مرة أخرى أن تقدير الوقت لمهمة ما هو مشكلة غير تافهة. حتى المهام الأولية لكتابة سيناريو 15 سطر يمكن أن تمتد لعدة ساعات.


كنت بحاجة إلى تكرار المعلومات من ملاحظات تخفيض السعر إلى قناة برقية. ويبدو أن شيئا ما إلى rassusolivat - Ctrl+Cو Ctrl+Vإلى المساعدة. ومع ذلك ، تم اكتشاف فارق بسيط: تم تخفيض السعر في سلة التسوق بشكل كامل [text](http://example.com) ولا يدعم العميل الروابط بهذا التنسيق . حسنًا ، فكرت ، لنحاول القيام بشيء حيال ذلك.



تحاول التغلب على المشاجرة



قم بتحرير الروابط بيديك ، خاصة عندما يكون هناك العديد منها - إلى حد ما كئيب. خاصة بالنظر إلى خطأ عميل سطح المكتب ، والذي يستحيل بسببه تحرير الرسائل المعلقة. من الممكن التحويل من جهاز لوحي ، لكنه أكثر ضغطًا.


, ? : . , .


xclip, . :


text/plain
UTF8_STRING
STRING
TEXT
application/x-td-field-text
application/x-td-field-tags

, Firefox:


text/html
text/_moz_htmlcontext
text/_moz_htmlinfo
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain
text/x-moz-url-priv

- Libre Office Writer:


application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source (XML)"
text/rtf
text/richtext
text/html
text/plain;charset=utf-16
application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object Descriptor (XML)";classname="8BC6B165-B1B2-4EDD-aa47-dae2ee689dd6";typename="LibreOffice 6.0 Text Document";viewaspect="1";width="16999";height="2995";posx="0";posy="0"
text/plain;charset=utf-8
UTF8_STRING
STRING
application/x-libreoffice-internal-id-5387

, , . , , . , -, , - , Qt , , - . 5 , - .




-, , . , , , . . .


, , . ? PyPI 31 "telegram". Telethon — , , , , , , , MTProto .


, . , , , .


from telethon.sync import TelegramClient
import socks

api_id = 11111
api_hash = '...'
proxy=(socks.SOCKS4, '127.0.0.1', 9050)

with TelegramClient('anon', api_id, api_hash, proxy=proxy, timeout=60) as client:
    print(client.get_me().stringify())

… - , . , HACKERMAN, . , .



We need to do deeper


, , Tor, :


$ curl -XGET httpbin.org/ip --socks5 localhost:9050

, — . , , Telethon. ? PySocks. , -. , . ...


Traceback (most recent call last):
  File "test.py", line 110, in <module>
    print("HTTP: " + opener.open("http://httpbin.org/ip").read().decode())
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "test.py", line 94, in http_open
    return self.do_open(build, req)
  File "/usr/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1254, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1300, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1249, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1036, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 974, in send
    self.connect()
  File "test.py", line 55, in connect
    ((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),))
  File "/usr/lib/python3/dist-packages/socks.py", line 200, in create_connection
    proxy_username, proxy_password)
  File "/usr/lib/python3/dist-packages/socks.py", line 322, in set_proxy
    username.encode() if username else None,
AttributeError: 'int' object has no attribute 'encode'

… ? https , ! … 6 ? :(


15-20 - , — , . -c , . : , .


, , , . ? , - Telethon? , , . -:


DEBUG:telethon.network.mtprotosender:Connection attempt 2...
WARNING:telethon.network.mtprotosender:Attempt 2 at connecting failed: ProxyConnectionError: Error connecting to SOCKS4 proxy 127.0.0.1:9050: [Errno 115] Operation now in progress

? EINPROGRESS, connect. , , ( ) , . : Tor . , 10- , 5 , …


, , , , , -. — Telethon. Telethon PySocks.


-


: -. — , , . Telethon . : , . , , . : - Telethon.



, - , , : . , .


- s.setblocking(False)
+ s.settimeout(timeout)

, , , . , , PR.




, , ? - , , . , , , . - : , :



api_key api_hash, /, ? , Telethon — . , ? , ? - ?


( ) Vault, , , … , , . . :


?)

...



keyring. plain-text, , . .



, , — , — , , . 50 , 10, — , . - .


, , - , . !


All Articles