Is this not the correct way set a cookie in suds?
# Create session cookie. oizysSessionCookie = cookielib.Cookie(version=None, name="ASP.NET_SessionId",
value=self.loginCredentials.session_id, port="8082", port_specified=False, domain="127.0.0.1", domain_specified=True, domain_initial_dot=False, path="ISTSessionId", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest=None) # Add cookie to clients commandClient = Client(commandUrl)
commandClient.options.transport.cookiejar.set_cookie(oizysSessionCookie) monitorClient = Client(monitorUrl)
monitorClient.options.transport.cookiejar.set_cookie(oizysSessionCookie)
I am guessing here.... you are attempting to configure the http client to automatically manage cookies for you... if all you need is send a cookie and if you already know its value, whats wrong with just setting it like I suggested as a simple additional header? are you over complicating it, or am completely mis understanding the issue?
Mohamed.
2009/3/17 David Bunch david.e.bunch@gmail.com:
Is this not the correct way set a cookie in suds?
# Create session cookie. oizysSessionCookie = cookielib.Cookie(version=None, name="ASP.NET_SessionId",
value=self.loginCredentials.session_id, port="8082", port_specified=False, domain="127.0.0.1", domain_specified=True, domain_initial_dot=False, path="ISTSessionId", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest=None) # Add cookie to clients commandClient = Client(commandUrl)
commandClient.options.transport.cookiejar.set_cookie(oizysSessionCookie) monitorClient = Client(monitorUrl)
monitorClient.options.transport.cookiejar.set_cookie(oizysSessionCookie)
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
Ignore me. I think you are on the right path trying to install your own transport...
On Tue, Mar 17, 2009 at 8:43 PM, Mohamed Lrhazi lrhazi@gmail.com wrote:
I am guessing here.... you are attempting to configure the http client to automatically manage cookies for you... if all you need is send a cookie and if you already know its value, whats wrong with just setting it like I suggested as a simple additional header? are you over complicating it, or am completely mis understanding the issue?
Mohamed.
2009/3/17 David Bunch david.e.bunch@gmail.com:
Is this not the correct way set a cookie in suds?
# Create session cookie. oizysSessionCookie = cookielib.Cookie(version=None, name="ASP.NET_SessionId",
value=self.loginCredentials.session_id, port="8082", port_specified=False, domain="127.0.0.1", domain_specified=True, domain_initial_dot=False, path="ISTSessionId", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest=None) # Add cookie to clients commandClient = Client(commandUrl)
commandClient.options.transport.cookiejar.set_cookie(oizysSessionCookie) monitorClient = Client(monitorUrl)
monitorClient.options.transport.cookiejar.set_cookie(oizysSessionCookie)
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
-- " Logic merely sanctions the conquests of the intuition." Jacques Hadamard
The transport already uses cookielib to round-trip cookies. But, it looks like in this case, you need to add a cookie using the value returned in a previous call, right?
Seeing how there is a need ... I'd like to add a way to set and get cookies to the client api but don't want to tie it to a specific transport implementation (cookiejar and urllib2).
How many of these cookie parameters are generic?
Eg:
import from suds.cookie import Cookie
cookie = Cookie(port="8082", # I'd bet many of these could be defaulted. port_specified=False, domain="127.0.0.1", domain_specified=True, domain_initial_dot=False, path="ISTSessionId", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest=None)
client.setcookie(cookie) cookies = client.getcookies()
Would this be a good idea?
Thoughts, suggestions?
I'm not an expert on cookies :)
David Bunch wrote:
Is this not the correct way set a cookie in suds?
# Create session cookie. oizysSessionCookie = cookielib.Cookie(version=None, name="ASP.NET_SessionId",
value=self.loginCredentials.session_id, port="8082", port_specified=False, domain="127.0.0.1", domain_specified=True, domain_initial_dot=False, path="ISTSessionId", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest=None) # Add cookie to clients commandClient = Client(commandUrl)
commandClient.options.transport.cookiejar.set_cookie(oizysSessionCookie) monitorClient = Client(monitorUrl)
monitorClient.options.transport.cookiejar.set_cookie(oizysSessionCookie)
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list
Hi Jeff,
Thanks for the reply. Yeah unfortunately im not an expert on cookies myself. In fact, as you probably guessed, I'm pretty new to web services and soap in general. I can't really say what would be good defaults on new cookies added through your client API, but, like you said, all I am trying to do is set a cookie to a specific value that was returned to me from a login call (strangely, it does not set the cookie for you, instead it just returns a session ID that it expects you to set it). But yes, I think having a way to set and get cookies via the client API would be a good idea. But thats just IMHO :-)
-David
On Wed, Mar 18, 2009 at 5:29 AM, Jeff Ortel jortel@redhat.com wrote:
The transport already uses cookielib to round-trip cookies. But, it looks like in this case, you need to add a cookie using the value returned in a previous call, right?
Seeing how there is a need ... I'd like to add a way to set and get cookies to the client api but don't want to tie it to a specific transport implementation (cookiejar and urllib2).
How many of these cookie parameters are generic?
Eg:
import from suds.cookie import Cookie
cookie = Cookie(port="8082", # I'd bet many of these
could be defaulted.
port_specified=False, domain="127.0.0.1", domain_specified=True, domain_initial_dot=False, path="ISTSessionId", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest=None)
client.setcookie(cookie) cookies = client.getcookies()
Would this be a good idea?
Thoughts, suggestions?
I'm not an expert on cookies :)
David Bunch wrote:
Is this not the correct way set a cookie in suds?
# Create session cookie. oizysSessionCookie = cookielib.Cookie(version=None,
name="ASP.NET_SessionId",
value=self.loginCredentials.session_id, port="8082", port_specified=False, domain="127.0.0.1", domain_specified=True,
domain_initial_dot=False, path="ISTSessionId", path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest=None) # Add cookie to clients commandClient = Client(commandUrl)
commandClient.options.transport.cookiejar.set_cookie(oizysSessionCookie) monitorClient = Client(monitorUrl)
monitorClient.options.transport.cookiejar.set_cookie(oizysSessionCookie)
fedora-suds-list mailing list fedora-suds-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-suds-list