question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cookies issue on windows with pycurl version pycurl 7.43.0.1

See original GitHub issue

Проверял на:

Microsoft Windows Server 2012 Standard
Microsoft Windows 7 Ultimate

Версия питона на обоих машинах: Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32

grab=0.6.3.8

Код:

from grab import Grab, error
import sys
import logging
import base64

g = Grab()
g.setup(timeout=60)
g.setup(debug=True, debug_post=True)

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

# запрятано в интересах приватности
url, login, pwd = base64.b64decode("v1WZktzbtVGZ7AHaw5CelRmbp9icvRXYyR3cp5WatRWYvwGcu0Wdw12LvoDc0RHa"[::-1])\
    .decode("utf-8").split(";")

g.go(url)
g.doc.set_input('username', login)
g.doc.set_input('passwd', pwd)
try:
    g.doc.set_input('lang', 'en-GB')
except:
    pass
g.doc.submit()

is_logged = g.doc.text_search("task=logout")
if not is_logged:
    raise error.GrabError("не вошли")

print("all right!")

Ставим pycurl-7.19.5.3, получаем результат: all right!

Ставим последний pycurl-7.43.0.1, получаем: grab.error.GrabError: не вошли

Это не особенность сайта, я проверял в других местах и там тоже самое. Сверял руками тело пост запроса с тем что отправляется в браузере, содержимое идентично.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
InputErrorcommented, Dec 27, 2017

@lorien святая невнимательность! Вот же комит есть! https://github.com/lorien/grab/pull/286 я применил комит и всё заработало отлично как положено! Очень прошу Вас пожалуйста тот комит влить в мастер ветку, или допилить его в зависимости от версии pycurl чтобы всё норм подставляло там.

@p глубоко извиняюсь за отнятое у Вас время и премного благодарен Вам за участие! От души! Не хочется отвлекать таких серьёзных людей по пустякам!

@lorien баг этот крови много выпил, надеюсь вольёте в мастер ветку в ближайшее время, очень нужно.

1reaction
pcommented, Dec 26, 2017

Could you tell me please, you found this thread through the my profile, right?

Yup.

and do you speak Russian?

Yes, prefer to not write it though.

If you look carefully at the server output in works.txt you’ll see:

DEBUG:grab.transport.curl:<: b'HTTP/1.1 500 Cannot write to log file.'

In other words, the request failed but not in a way you were expecting. It is likely that the request you consider working does not in fact work, i.e., you were not logged in.

The difference in cookie output probably has to do with the “working” request actually failing with the 500 which happens on the web server level, thus the application’s cookies are not returned.

As far as I can tell neither request sends cookies, so if they need to be sent this is something that must be configured, probably in Grab somewhere.

weird changes in proxy request

These most likely don’t matter and are just a difference in debug output between different libcurl versions.

It is possible the 500 is intermittent, try rerunning that configuration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The cookies from the saved cookie file, can not be submitted ...
The cookies from the saved cookie file, can be submitted to the server, at first time. What is the PycURL version? import pycurl...
Read more >
A Python Interface To The cURL library — PycURL 7.43.0.1 ...
libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, ...
Read more >
Can't install pycurl with pip - Stack Overflow
Following the steps one mentioned above, solved my problem. sudo apt install libcurl4-gnutls-dev librtmp-dev pip install pycurl.
Read more >
Error 60: SSL failed under pycurl, but works under normal curl
System: windows 7. Pycurl version: PycURL/7.43.0.1 libcurl/7.57.0 OpenSSL/1.1.0g zlib/1.2.11 c-ares/1.13.0 libssh2/1.8.0. curl version:
Read more >
pycurl 7.43.0 - PyPI
PycURL -- A Python Interface To The cURL library. ... Binary wheels are now available for 32 and 64 bit Windows versions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found