Thanks for the response! Dir gives me this:
dir = ['AddRef', '_oleobj_', '__hash__', 'GetTypeInfo', '_username_', '_FlagAsMethod', '__str__', '__format__', '_wrap_dispatch_', '_enum_', '__call__', '__int__', '_get_good_object_', '_print_details_', 'Invoke', '__sizeof__', 'Key', '_mapCachedItems_', '__setattr__', '_dir_ole_', '__class__', '__subclasshook__', 'Release', '_builtMethods_', '_olerepr_', '__repr__', '_find_dispatch_type_', '__ge__', '__weakref__', 'GetTypeInfoCount', '__dict__', 'GetIDsOfNames', '_proc_', '_get_good_single_object_', '__gt__', '__doc__', '__ne__', 'QueryInterface', '__module__', '_Release_', '__eq__', '__getattribute__', '__le__', '__reduce_ex__', '__delattr__', '__new__', '_NewEnum', '__lt__', '_LazyAddAttr_', '__LazyMap__', '__len__', '_ApplyTypes_', '__dir__', '__bool__', '_lazydata_', '__getattr__', '_make_method_', '__AttrToID__', '__init__', '_unicode_to_string_', 'Count', '__reduce__', '__setitem__', 'Item', '__getitem__', '__init_subclass__', '_UpdateWithITypeInfo_'] I’ll continue to play with the parameters! Steven From: python-win32 <python-win32-bounces+steven=manross....@python.org> On Behalf Of Mark Hammond Sent: Wednesday, October 23, 2024 7:53 PM To: python-win32@python.org Subject: Re: [python-win32] Classic ASP -> Response.Cookies access On 2024-10-23 7:42 p.m., Steven Manross wrote: I’m not sure if this is implemented or not in the Python ASP code or not, but I am trying to duplicate some VBS code in Python, and use the URL below as a primer as I couldn’t find any info on the internet about how Python might implement this kind of ASP code. I know the link is SUPER OLD but it’s the best docs I have been able to find on the subject. https://learn.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524757(v=vs.90) I am trying to create cookies similar to how the Microsoft Certificate Authority Website on Windows Server 2016/2019/2022 does. Here’s my Python ASP code <% @Language="Python"%> <% Response.Write("Here<BR>") for cookie in Response.Cookies: Response.Write(Response.Cookies(cookie)["expires"]) Response.Write(f"dir = {Response.Cookies.__dir__()}") if not "Type" in Response.Cookies: cookie = Response.Cookies["type"] = "peanut-butter" # simplistic example of trying to create one Response.Write("Past Cookie Creation code<BR>") %> Here’s my error: Python ActiveX Scripting Engine error '80020009' Traceback (most recent call last): File "<Script Block >", line 3, in <module> cookie = Response.Cookies["type"] = "peanut-butter" File "C:\Python310\lib\site-packages\win32com\client\dynamic.py", line 348, in __setitem__ self._oleobj_.Invoke(*allArgs), self._olerepr_.defaultDispatchName, None COM Error: OLE error 0x80020101 /testcookies.asp, line 5 cookie = Response.Cookies["type"] = "peanut-butter" Any guidance would be appreciated as I’ve scoured google for all it was worth. Response.Cookies is "just" a dynamic COM object/collection and pywin32 has never been great with them and "magic" things like properties etc due to various semantic mismatches. If you are lucky, there might be a method on the object taking 2 params? I'm guessing `__dir__` didn't help? Regardless, a last resort would be to unwrap that __setitem__ call and experiment with the correct "DISPATCH_*" flags (and in particular, trying "DISPATCH_METHOD", because the examples are all showing function calls to "set" a value, which python has no concept of!) - the other values are probably correct. HTH, Mark
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32