Re: How to load cookies from a json input in python-requests?

2019-08-12 Thread Alexandre Brault
On 2019-08-12 11:38 p.m., Peng Yu wrote: ``` import requests s = requests.Session() import json s.cookies.set_cookie(requests.utils.cookiejar_from_dict(json.load(sys.stdin))) ``` I used the above command to load cookies from a json file. But I got the following error. Does anybody know how to

How to load cookies from a json input in python-requests?

2019-08-12 Thread Peng Yu
``` import requests s = requests.Session() import json s.cookies.set_cookie(requests.utils.cookiejar_from_dict(json.load(sys.stdin))) ``` I used the above command to load cookies from a json file. But I got the following error. Does anybody know how to fix the error? Thanks. ``` Traceback (most

Re: Cookies not showing up in environ

2018-07-25 Thread abc abc
Yes, this was the problem. At some point early in my attempts I got the idea that linking up Django to a production web server required writing a separate wsgi.py script. Wrong. Replaced the wsgi.py with the default Django wsgi.py for the project and everything seems resolved. Thank you. -- htt

Re: Cookies not showing up in environ

2018-07-21 Thread Jon Ribbens
in; charset=utf-8')]) > return [environ.get('HTTP_COOKIE', '').encode('utf-8')] You should delete that and change it back to whatever 'django startproject' gave you originally for wsgi.py. If you're writing a django app then you don&#

Re: Cookies not showing up in environ

2018-07-21 Thread abc abc
_folder/app/views.py: from django.http import HttpResponse def cookies(request): return HttpResponse(repr(request.COOKIES), 'text/plain; charset=utf-8') def index(request): print 'INDEX: ' print request.COOKI

Re: Cookies not showing up in environ

2018-07-21 Thread abc abc
_folder/app/views.py: from django.http import HttpResponse def cookies(request): return HttpResponse(repr(request.COOKIES), 'text/plain; charset=utf-8') def index(request): print 'INDEX: ' print request.COOKI

Re: Cookies not showing up in environ

2018-07-21 Thread Jon Ribbens
WSGI: def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain; charset=utf-8')]) return [environ.get('HTTP_COOKIE', '').encode('utf-8')] Django: views.p

Re: Cookies not showing up in environ

2018-07-20 Thread abc abc
ave a file project/project/wsgi.py that has a function called 'application' that gets called; still a little fuzzy on whose calling it and passing these parameters. I understood that the cookies should be in HTTP_COOKIES inside the environ hash... they're not. From wsgi.py I ca

Re: Cookies not showing up in environ

2018-07-20 Thread Peter J. Holzer
On 2018-07-20 12:39:38 -0700, abc abc wrote: > I am trying the simplest of examples below to set and read a cookie. I > am using the Django framework, but I have also tried with vanilla > python cookies and os.environ. I have posted elsewhere, but this > hasn't gotten much attenti

Re: Cookies not showing up in environ

2018-07-20 Thread Calvin Spealman
You can read cookies from the request via the request.COOKIES dictionary. See the documentation here: https://docs.djangoproject.com/en/2.0/ref/request-response/#django.http.HttpRequest.COOKIES You won't find them in an environment variable, which is shared process-wide and across all req

Cookies not showing up in environ

2018-07-20 Thread abc abc
I am trying the simplest of examples below to set and read a cookie. I am using the Django framework, but I have also tried with vanilla python cookies and os.environ. I have posted elsewhere, but this hasn't gotten much attention, so I'd really appreciate any help. Thinking at thi

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-30 Thread Luca Cerone
Thanks Dieter, > With respect to cookie handling, you do everything right. > > > > There may be other problems with the (wider) process. > > Analysing the responses of your requests (reading the status codes, > > the response headers and the response bodies) may provide hints > > towards th

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-27 Thread dieter
;\{(.*)\}') > > base_url = "http://quiz.gambitresearch.com"; > job_url = base_url + "/job/" > > cookies = CookieJar() > r = Request(base_url) #prepare the request object > cookies.add_cookie_header(r) #allow to have cookies > R = urlopen(r) #read the url > coo

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-27 Thread Luca Cerone
#START from urllib2 import urlopen , Request from cookielib import CookieJar import re regex = re.compile(r'\{(.*)\}') base_url = "http://quiz.gambitresearch.com"; job_url = base_url + "/job/" cookies = CookieJar() r = Request(base_url) #prepare the reque

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-27 Thread Luca Cerone
Dear all, first of all thanks for the help. As for your remark, you are right, and I usually tend to post questions in a way that is detached from the particular problem I have to solve. In this case since I only have a limited knowledge of the cookies mechanism (in general, not only in Python

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-21 Thread dieter
Luca Cerone writes: >... > Have you tried this code to check if this work? Not this code, but code like this (as I have written). > If it works as intended can you explain a bit better > what it does exactly? Fabio already did the explanation. Let me make an additional remark however: you sh

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-21 Thread Fábio Santos
On 21 Aug 2013 09:22, "Luca Cerone" wrote: > > > > > I have used "cookielib" externally to "urllib2". It looks > > > > like this: > > > > from urllib2 import urlopen, Request > > > > from cook

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-21 Thread Luca Cerone
> > I have used "cookielib" externally to "urllib2". It looks > > like this: > > from urllib2 import urlopen, Request > > from cookielib import CookieJar > cookies = CookieJar() > > > > r = Request(...) > > cookies.add_c

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-20 Thread dieter
quot;cookielib" externally to "urllib2". It looks like this: from urllib2 import urlopen, Request from cookielib import CookieJar cookies = CookieJar() r = Request(...) cookies.add_cookie_header(r) # set the cookies R = urlopen(r, ...) # make the request cookies.extrac

How to keep cookies when making http requests (Python 2.7)

2013-08-20 Thread Luca Cerone
g content now: "WRONG! (Have you enabled cookies?)" Trying to solve the issues with the cookies I found the "requests" module that in theory should work. I therefore rewrote the above script to use request: #START SCRIPT: import re import requests regex = re.compile(r'

m2crypto https, xmlrpc, and cookies

2011-08-02 Thread Gelonida N
svr.mymethod1(1) svr.mynethod2(2) What I wondered is following: When using my web browser certain cookies are sent with the request. Is there any way to change my above code such, that cookies would be collected and sent? Thanks in advance for any pointers. -- http://mail.python.org/mailman/

Re: Use cookies from a script in a browser

2011-03-21 Thread Rafael Durán Castañeda
I think this<http://stackoverflow.com/questions/189555/how-to-use-python-to-login-to-a-webpage-and-retrieve-cookies-for-later-usage>could help you 2011/3/18 gervaz > On 18 Mar, 22:52, Miki Tebeka wrote: > > You can use mechanize, which holds a cookie jar and can user the brows

Re: Use cookies from a script in a browser

2011-03-18 Thread gervaz
On 18 Mar, 22:52, Miki Tebeka wrote: > You can use mechanize, which holds a cookie jar and can user the browser > cookies as well. I use: opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor()) urllib.request.install_opener(opener) I start scraping from http://pa

Re: Use cookies from a script in a browser

2011-03-18 Thread Miki Tebeka
You can use mechanize, which holds a cookie jar and can user the browser cookies as well. -- http://mail.python.org/mailman/listinfo/python-list

Use cookies from a script in a browser

2011-03-18 Thread gervaz
Hi all, I use a scraper to retrieve data from a web page. In order to do that I need to enable cookies. The data that I'm looking for is contained in a bunch of web pages. Is there a way to show this web pages in a browser using the cookies used in the script (otherwise it doesn't work

Re: Cookies

2009-12-31 Thread Victor Subervi
I'm curious. Are there other instances where code needs to be inserted into the header as in the print cookie to get it to be baked on the user's PC? TIA, beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Cookies

2009-12-31 Thread Victor Subervi
On Thu, Dec 31, 2009 at 1:10 AM, Carsten Haese wrote: > Victor Subervi wrote: > > You know, neither one of those tutorials I followed gave clear, or any, > > instruction about putting a > > print cookie > > statement in the header! How misleading! > > Don't blame the tutorials for your failure to

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > You know, neither one of those tutorials I followed gave clear, or any, > instruction about putting a > print cookie > statement in the header! How misleading! Don't blame the tutorials for your failure to read them carefully. The tutorial you mentioned (http://www.doughell

Re: Cookies

2009-12-30 Thread Steve Holden
to do you wouldn't have needed to be told because you would have known that the cookies were transmitted as HTTP headers and that you had to somehow put that information into the headers (in other words, that creating a cookie was not sufficient to insert it into the HTTP output stream). regards

Re: Cookies

2009-12-30 Thread Victor Subervi
You know, neither one of those tutorials I followed gave clear, or any, instruction about putting a print cookie statement in the header! How misleading! beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:51 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Comments from a left-brain thinker without any concept of how difficult > > it is for a right-brain thinker to think like you. Care to compare > > poetry? I'd bury you. > > That may be so, but the difference is that

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:51 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Comments from a left-brain thinker without any concept of how difficult > > it is for a right-brain thinker to think like you. Care to compare > > poetry? I'd bury you. > > That may be so, but the difference is that

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:43 PM, Carsten Haese wrote: > Anyway, the likely answer is that you guessed incorrectly. As I said > before, you need to make sure that the cookie is printed as part of the > page headers. I'll give you one last hint: The page header is where > you're printing the "Conte

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > Comments from a left-brain thinker without any concept of how difficult > it is for a right-brain thinker to think like you. Care to compare > poetry? I'd bury you. That may be so, but the difference is that Steve is not trying to earn a living writing poetry as far as I kn

Re: Cookies

2009-12-30 Thread Carsten Haese
Victor Subervi wrote: > I've revised the code thus: > > cookie = os.environ.has_key('HTTP_COOKIE') > if not cookie: > cookie = Cookie.SimpleCookie() > cExpires, cPath, cComment, cDomain, cMaxAge, cVersion = myCookie() > cookie['lastvisit'] = str(time.time()) > cookie['lastvisit

Re: Cookies

2009-12-30 Thread Victor Subervi
On Wed, Dec 30, 2009 at 12:19 PM, Steve Holden wrote: > Carsten Haese wrote: > I will point out again, without the least expectation that it will do > any good, that the reason this problem has occurred is that Victor > simply refuses to take the time to absorb the principles of what he is > atte

Re: Cookies

2009-12-30 Thread Victor Subervi
['lastvisit']['path'] = cPath > > cookie['lastvisit']['comment'] = cComment > > cookie['lastvisit']['domain'] = cDomain > > cookie['lastvisit']['max-age'] = cMaxAge > > cookie['la

Re: Cookies

2009-12-30 Thread Steve Holden
Carsten Haese wrote: > Victor Subervi wrote: [...] > Pardon me for not being able to read your mind. The code you're now > posting is significantly more code than your first post included. The > line that I had determined to be missing is in fact not missing, you > just didn't bother to post your a

Re: Cookies

2009-12-30 Thread Carsten Haese
t']['max-age'] = cMaxAge > cookie['lastvisit']['version'] = cVersion > cookie['mycookie'] = 'mycookie' > cookieFlag = 'new' > else: > cookie = Cookie.SimpleCookie(cookie) > cookieFlag = 'old&#

Re: Cookies

2009-12-30 Thread Victor Subervi
visit']['comment'] = cComment cookie['lastvisit']['domain'] = cDomain cookie['lastvisit']['max-age'] = cMaxAge cookie['lastvisit']['version'] = cVersion cookie['mycookie'] = 'mycookie'

Re: Cookies

2009-12-30 Thread Carsten Haese
> http://www.doughellmann.com/PyMOTW/Cookie/index.html > > I read the following: > > > Cookies are used as state management, and as such as usually set by the > server to be stored and returned by the client. The most trivial example > of creating a cookie looks something l

Re: Cookies

2009-12-30 Thread Victor Subervi
x27; > > else: > > cookie = Cookie.SimpleCookie(cookie) > > cookieFlag = 'old' > > print '''Content-Type: text/html\r\n > > > > > > ''' > > print cookieFlag > > > > cookieFlag print

Re: Cookies

2009-12-29 Thread Carsten Haese
ontent-Type: text/html\r\n > > > ''' > print cookieFlag > > cookieFlag prints 'new'. Every time. Even when I refresh. I've imported > Cookie. I've followed the tutorials :-} I've already been through my > problem with trying to fin

Cookies

2009-12-29 Thread Victor Subervi
stvisit']['version'] = cVersion cookieFlag = 'new' else: cookie = Cookie.SimpleCookie(cookie) cookieFlag = 'old' print '''Content-Type: text/html\r\n ''' print cookieFlag cookieFlag prints 'new'. Every time.

Re: (OT) Where Are Cookies Stored?

2009-12-17 Thread Lie Ryan
On 12/17/2009 2:33 AM, Dave Angel wrote: Victor Subervi wrote: On Tue, Dec 15, 2009 at 6:57 PM, r0g wrote: Cookies in FF for Windows are stored in an sqlite database in here... ~\Application Data\Mozilla\Firefox\Profiles\%XYZ%\firefox_profile\ Man, I searched C drive (the only drive

Re: (OT) Where Are Cookies Stored?

2009-12-16 Thread Victor Subervi
On Wed, Dec 16, 2009 at 11:33 AM, Dave Angel wrote: > > > Victor Subervi wrote: > >> On Tue, Dec 15, 2009 at 6:57 PM, r0g wrote: >> >> >> >> Cookies in FF for Windows are stored in an sqlite database in here... >>> >>> ~\App

Re: (OT) Where Are Cookies Stored?

2009-12-16 Thread David Robinow
On Wed, Dec 16, 2009 at 10:33 AM, Dave Angel wrote: > You can also find the appdata directory by looking at the environment > variable USERPROFILE, switching to that directory, and descending directly > into "application data" by using the tab key. > ... Lots of good advice. I'd just point out tha

Re: (OT) Where Are Cookies Stored?

2009-12-16 Thread Dave Angel
Victor Subervi wrote: On Tue, Dec 15, 2009 at 6:57 PM, r0g wrote: Cookies in FF for Windows are stored in an sqlite database in here... ~\Application Data\Mozilla\Firefox\Profiles\%XYZ%\firefox_profile\ Man, I searched C drive (the only drive) on this computer where I'm wo

Re: (OT) Where Are Cookies Stored?

2009-12-16 Thread Victor Subervi
On Tue, Dec 15, 2009 at 6:29 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Tue, 15 Dec 2009 13:03:07 -0300, Gabriel Genellina wrote: > > > En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi > > escribió: > > > >> I've goo

Re: (OT) Where Are Cookies Stored?

2009-12-16 Thread Victor Subervi
On Tue, Dec 15, 2009 at 6:57 PM, r0g wrote: > Gabriel Genellina wrote: > > En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi > > escribió: > > > >> I've googled, found where cookies are supposed to be, the folders and > >> files > >> don&#x

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread Dave Angel
Victor Subervi wrote: Hi; I've googled, found where cookies are supposed to be, the folders and files don't exist. I've opened my latest and greatest FF and seen cookies in there, but when I search for the name of the cookie in the C: dir, it's not there...anywhere. I

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread r0g
r0g wrote: > Gabriel Genellina wrote: >> En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi >> escribió: >> >>> I've googled, found where cookies are supposed to be, the folders and >>> files >>> don't exist. I've opened my latest a

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread r0g
Gabriel Genellina wrote: > En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi > escribió: > >> I've googled, found where cookies are supposed to be, the folders and >> files >> don't exist. I've opened my latest and greatest FF and seen cookies in >&

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread Steven D'Aprano
On Tue, 15 Dec 2009 13:03:07 -0300, Gabriel Genellina wrote: > En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi > escribió: > >> I've googled, found where cookies are supposed to be, the folders and >> files don't exist. [...] > How the browser store

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread Victor Subervi
On Tue, Dec 15, 2009 at 12:03 PM, Gabriel Genellina wrote: > En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi < > victorsube...@gmail.com> escribió: > > > I've googled, found where cookies are supposed to be, the folders and >> files >> don't exist

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread Gabriel Genellina
En Tue, 15 Dec 2009 12:30:23 -0300, Victor Subervi escribió: I've googled, found where cookies are supposed to be, the folders and files don't exist. I've opened my latest and greatest FF and seen cookies in there, but when I search for the name of the cookie in the C:

Re: (OT) Where Are Cookies Stored?

2009-12-15 Thread Victor Subervi
/askville.amazon.com/Firefox-store-cookies/AnswerViewer.do?requestId=5709350 > [2]: http://lists.evolt.org/mailman/listinfo/thelist > Yeah, did all that and found them thru FF. I can delete them. I'd like to open the cookie I'm setting, and haven't figured out how to do th

(OT) Where Are Cookies Stored?

2009-12-15 Thread Victor Subervi
Hi; I've googled, found where cookies are supposed to be, the folders and files don't exist. I've opened my latest and greatest FF and seen cookies in there, but when I search for the name of the cookie in the C: dir, it's not there...anywhere. I've made sure no folde

Re: Module/Library That is Able To Use Cookies + Proxies?

2009-01-29 Thread Justin Ezequiel
On Jan 30, 12:06 pm, blackcapsoftw...@gmail.com wrote: > I would like to do is be able to log into a site that uses cookies to > store information about the user when logging in. This works fine and > dandy with ClientCookie. Now, I want to be able to do so with a proxy, urll

Module/Library That is Able To Use Cookies + Proxies?

2009-01-29 Thread blackcapsoftware
Hey guys, I have been search the net for a bit now and can't find anything. What I would like to do is be able to log into a site that uses cookies to store information about the user when logging in. This works fine and dandy with ClientCookie. Now, I want to be able to do so with a proxy,

[cookielib] How to add cookies myself?

2008-12-16 Thread Gilles Ganault
Hello I'm using urllib and urlib to download data from a web server that requires cookies. The issue I'm having, is the server uses JavaScript in the response to insert new cookies and send them with the next query, so I need to manually add a couple of cookies in the CookieJar, but I

HTTPConnection Sending Cookies to server

2008-12-14 Thread Lamonte Harris
Right now I can login to www.phpbb.com's forums import httplib, urllib params = urllib.urlencode({'username':'TheInfernoSin','password':'PASSWORD','login':1,'sid':'','redirect':'index.php','autologin':1}) headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"} con =

Re: Inserting cookies into a web session

2008-07-24 Thread John Gordon
imes", I just set the cookie to that choice. I don't have to worry about passing the choice around in each of the dozen or so forms that are on the page. > Before using cookies keep in mind that the cookies returned by the > browser are not trustworthy! You have to validate the

Re: Inserting cookies into a web session

2008-07-24 Thread Michael Ströder
What's the problem? Then a coworker suggested that I could just insert a cookie into the current session, which would store whatever information I wanted. This seems like a really good solution. That's what cookies are *for*, right? Before using cookies keep in mind that the cookies re

Inserting cookies into a web session

2008-07-23 Thread John Gordon
ed that I could just insert a cookie into the current session, which would store whatever information I wanted. This seems like a really good solution. That's what cookies are *for*, right? But I've never worked with cookies before. Is there a Python package for handling cookie

Re: Cookies and CookieJar

2008-05-17 Thread 7stud
Larry Bates wrote: > I'm struggling with a project using mechanize and cookies to screen scape a > website. The site requires a client created cookie for authentication. Are you sure that is correct? As far as I know, the usual course of events is for a site to set a cookie he

Re: Cookies and CookieJar

2008-05-17 Thread 7stud
On May 16, 9:21 am, Larry Bates <[EMAIL PROTECTED]> wrote: > I'm struggling with a project using mechanize and cookies to screen scape a > website.  The site requires a client created cookie for authentication.  Below > is the code I'm attempting to use with

Cookies and CookieJar

2008-05-16 Thread Larry Bates
I'm struggling with a project using mechanize and cookies to screen scape a website. The site requires a client created cookie for authentication. Below is the code I'm attempting to use with the traceback I'm getting: >>> import Cookie >>> c=Cookie

Re: Recommended way to POST with cookies?

2008-05-15 Thread Laszlo Nagy
Gilles Ganault wrote: Hello According to Google, there seems to be several tools available, possibly deprecated, to download data from web pages by POSTing forms and save cookies to maintain state. I need to write a script under Windows with ActivePython 2.5.1.1 that would do this: 1

Recommended way to POST with cookies?

2008-05-14 Thread Gilles Ganault
Hello According to Google, there seems to be several tools available, possibly deprecated, to download data from web pages by POSTing forms and save cookies to maintain state. I need to write a script under Windows with ActivePython 2.5.1.1 that would do this: 1. Connect through a local

Quixote cookies

2008-01-20 Thread [EMAIL PROTECTED]
Hi, guys I'm trying to use cookies in Quixote. This is the code: env = copy(os.environ) req = HTTPRequest(sys.stdin, env) req.response.set_cookie("xxx","666") cc = req.get_cookie("xxx"); For some reason it cc is always None. What am I doing wrong? -- http

Re: Handling cookies without urllib2 and cookielib

2007-12-17 Thread Joshua Kugler
Gabriel Genellina wrote: > On 14 dic, 23:44, Joshua Kugler <[EMAIL PROTECTED]> wrote: > >> I'm using HTTPlib to construct some functional tests for a web app we're >> writing. We're not using urllib2 because we need support for PUT and >> DELETE methods, which urllib2 does not do. >> >> We also

Re: Handling cookies without urllib2 and cookielib

2007-12-15 Thread Gabriel Genellina
On 14 dic, 23:44, Joshua Kugler <[EMAIL PROTECTED]> wrote: > I'm using HTTPlib to construct some functional tests for a web app we're > writing. We're not using urllib2 because we need support for PUT and > DELETE methods, which urllib2 does not do. > > We also need client-side cookie handling.

Handling cookies without urllib2 and cookielib

2007-12-14 Thread Joshua Kugler
httplib. And cookie lib has no simple function (that I could find) for passing in a set-cookie header and getting back a CookieJar object (or even a list of Cookie objects). I'm sure I'm not the first to have to deal with httplib and cookies. Anyone have suggestions or pointers? j

Re: instead of reading cookies (plan B)

2007-12-11 Thread Gabriel Genellina
En Tue, 11 Dec 2007 17:34:50 -0300, Vincent Hirth <[EMAIL PROTECTED]> escribi�: > I was just thinking of an alternative to reading cookies directly - at > least > in my case. What if I create a PHP file that contains the cookies in 2 > lines, such as this? > (

instead of reading cookies (plan B)

2007-12-11 Thread Vincent Hirth
I was just thinking of an alternative to reading cookies directly - at least in my case. What if I create a PHP file that contains the cookies in 2 lines, such as this? Myusername Mypassword What would the python script look like if I wanted to open the file and put the 2 values in

Re: reading cookies from PHP

2007-12-10 Thread Joshua Kugler
;s data? Will python be able to open the file and readthe > data? The TXT file can contain: > > Username = dude > Password = python Cookies are sent browser by the web server, and sent back to the web server by the browser. So, yes, you can set the cookie with the PHP script and read i

reading cookies from PHP

2007-12-10 Thread Jack Holt
Hello there. I’m a PHP fan but a Python newbie. I wrote anapplication in Python that needs to read a cookie setup from a PHP page. Is itpossible to do it? If not, what if I create a TXT file - as well as a cookie - thatcontains the cookie’s data? Will python be able to open the file and

Re: Script to POST to web page with cookies?

2007-07-20 Thread 7stud
On Jul 19, 7:43 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Hello > > I need to write a script to automate fetching data from a web site: > 1. using the POST method, log on, with login/password saved as cookies > 2. download page and extract relevent information using reg

Re: Script to POST to web page with cookies?

2007-07-19 Thread Miki
Hello Gille, > I need to write a script to automate fetching data from a web site: > 1. using the POST method, log on, with login/password saved as cookies > 2. download page and extract relevent information using regexes > 3. log off > 4. wait for a random number of minu

[2.5] Script to POST to web page with cookies?

2007-07-19 Thread Gilles Ganault
Hello I need to write a script to automate fetching data from a web site: 1. using the POST method, log on, with login/password saved as cookies 2. download page and extract relevent information using regexes 3. log off 4. wait for a random number of minutes, and GOTO 1 I'm a bit confused

Re: Client-side cookies on Python in Mac OSX

2007-07-14 Thread John J. Lee
Adrian Petrescu <[EMAIL PROTECTED]> writes: > Oh, you're right! Silly me, I had always thought it was standard. > Thanks for pointing this out! I went and downloaded ClientCookie and > it works great on OS X. And since it is BSD-licensed, I can use it in > my app without any fear. Perfect. > > Tha

Re: Client-side cookies on Python in Mac OSX

2007-07-12 Thread Adrian Petrescu
> > > Why would Apple go out of their way to remove this functionality from > > their shipped version of Python? More importantly, considering I need > > to programatically access a website that uses cookies for > > authentication, how can I do this in OSX's Python insta

Re: Client-side cookies on Python in Mac OSX

2007-07-12 Thread Graham Dumpleton
t; > >>> import ClientCookie > > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named ClientCookie > > Why would Apple go out of their way to remove this functionality from > their shipped version of Python? More impor

Client-side cookies on Python in Mac OSX

2007-07-12 Thread Adrian Petrescu
d ClientCookie Why would Apple go out of their way to remove this functionality from their shipped version of Python? More importantly, considering I need to programatically access a website that uses cookies for authentication, how can I do this in OSX's Python install? Do they provide some

Re: Sending cookies with python. When download with python

2007-06-05 Thread Matimus
On Jun 5, 9:14 am, [EMAIL PROTECTED] wrote: > I need to download files off a password protected website. So if I try > to download files off the site with python I will be blocked. Is there > anyway to send cookies with python. So I will be authenticated. Yes. I haven't done it

Re: Sending cookies with python. When download with python

2007-06-05 Thread Yongjian Xu
(url) headers = {'Cookie':'cookies','some_other_headers':'contents'} for k,v in headers.iteritems(): req.add_header(k,v) return req Hope it helps. Jim On 6/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I need to download files of

Sending cookies with python. When download with python

2007-06-05 Thread moishyyehuda
I need to download files off a password protected website. So if I try to download files off the site with python I will be blocked. Is there anyway to send cookies with python. So I will be authenticated. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-Page login WITH Cookies (POST Data)

2007-05-18 Thread Dave Borne
> After we are able to get a succussful login, i need a way that i can browse > my site always including this cookie, like if i went to open up a page, it > would use the cookie we got from logging in. You need something like this: import cookielib,urllib2 cookiejar = cookielib.CookieJar() opener

Multi-Page login WITH Cookies (POST Data)

2007-05-17 Thread Pyro
://pyro.allblizz.com/python/home.php (Home) (links are valid, and working submit system) Now, without cookies (just POST data) I am able to get this to work. [code] #!/usr/bin/python import sys from urllib2 import urlopen from ClientForm import ParseResponse forms = ParseResponse(urlopen("http:/

Testing a website with HTTPS login and cookies

2007-02-06 Thread Dwyer, Mike # ATLANTA
Did you ever get a response to your posting on "Testing a website with HTTPS login and cookies"? The reason I ask is that I need to do a similar thing, and am not being very successful getting pointers or sample code. Any response appreciated. /mike -- http://mail.python.org/mailma

Re: Retrieve HTML from site using cookies

2006-09-21 Thread James Stroud
a > redirect and it seems that the site is using a session (perhaps a > cookie) to determine whether the user is logged in. So I need to log in > and then have cookies and or sessions maintained as I access the page > that contains the content that I am actually interested in. > > Wh

Retrieve HTML from site using cookies

2006-09-21 Thread [EMAIL PROTECTED]
ssion (perhaps a cookie) to determine whether the user is logged in. So I need to log in and then have cookies and or sessions maintained as I access the page that contains the content that I am actually interested in. What is the simplest way to post data to a form, accept a cookie to maintain the se

Re: Testing a website with HTTPS login and cookies

2006-09-07 Thread John J. Lee
the address > of the internal page. I need to take that page href and then access > it, if I can do all that then the test passes. Of course because I > have to access two urls I also need cookies for session handling. I've > already tried bash which would have worked but for the co

Re: Testing a website with HTTPS login and cookies

2006-09-07 Thread John J. Lee
"Sandra-24" <[EMAIL PROTECTED]> writes: > Hari Sekhon wrote: > > If anybody knows how to do this could they please give me a quick > > pointer and tell me what libraries I need to go read up on? > > > > One word. Selenium. Didn't sound like a good fit for Selenium to me. Selenium's great, but

Re: Testing a website with HTTPS login and cookies

2006-09-05 Thread Sandra-24
Hari Sekhon wrote: > If anybody knows how to do this could they please give me a quick > pointer and tell me what libraries I need to go read up on? > One word. Selenium. -Sandra -- http://mail.python.org/mailman/listinfo/python-list

Testing a website with HTTPS login and cookies

2006-09-05 Thread Hari Sekhon
page href and then access it, if I can do all that then the test passes. Of course because I have to access two urls I also need cookies for session handling. I've already tried bash which would have worked but for the cookie handling and webinject which is written in Perl, but this doesn

Re: Getting and Setting Cookies

2006-07-20 Thread Vlad Dogaru
John J. Lee wrote: > "Vlad Dogaru" <[EMAIL PROTECTED]> writes: > [...] > > I am trying to write a simple login script. I understand (or rather I > > think I understand) how to set a cookie with the Cookie module. My > > problem is getting the cookies that

Re: Getting and Setting Cookies

2006-07-19 Thread John J. Lee
"Vlad Dogaru" <[EMAIL PROTECTED]> writes: [...] > I am trying to write a simple login script. I understand (or rather I > think I understand) how to set a cookie with the Cookie module. My > problem is getting the cookies that are currently set. How can I do > that?

Re: Getting and Setting Cookies

2006-07-19 Thread Vlad Dogaru
John J. Lee wrote: > "Vlad Dogaru" <[EMAIL PROTECTED]> writes: > > > I am trying to use cookies and Python to create a simple login example. > > But I am very disoriented at the existence of two cookie libraries, > > namely Cookie and cookielib.

  1   2   >