Question

from win32com.client import Dispatch

winhttp = Dispatch('winhttp.winhttprequest.5.1')

print winhttp.Option(6) #True

winhttp.Option(6) = False #SyntaxError  <----------------how to set Option(6) to false

print winhttp.Option(6)

winhttp.Open('GET', 'http://google.com', False)
winhttp.Send()

print winhttp.responsetext

===========================================

output:

invalid syntax: winhttp.py, line 13, pos 11 File "c:\Users\***\Desktop\winhttp.py", line 13, in ? set winhttp.Option(6) = False

how to do it? many thanks!

Was it helpful?

Solution

This should work:

winhttp.SetOption(6, False)

Unless you have some really good reason for using winhttprequest, I'd use something out of the Python standard library, or better yet install the requests library. You will find these options much easier to deal with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top