On Fri, Sep 27, 2013 at 9:27 AM, Grant Edwards wrote:
> I probably should have said "stdin", but in theory you can pass data
> in via multiple file descriptors. Nobody does that except people
> cooking up obscure examples for advanced shell scripting guides...
Yep. With that variant, I agree tha
On 2013-09-26, Chris Angelico wrote:
> On Fri, Sep 27, 2013 at 12:11 AM, Grant Edwards
> wrote:
>> On a Unix system when you invoke a program, you "pass" it four things:
>>
>> 1) A dictionary where keys/values are both strings [enviornment variables]
>> 2) A list of strings [command line args]
On Fri, Sep 27, 2013 at 12:11 AM, Grant Edwards wrote:
> On a Unix system when you invoke a program, you "pass" it four things:
>
> 1) A dictionary where keys/values are both strings [enviornment variables]
> 2) A list of strings [command line args]
> 3) A set of open file descriptors.
> 4) Th
On 2013-09-26, Chris Angelico wrote:
> On Thu, Sep 26, 2013 at 11:32 AM, Terry Reedy wrote:
>> Since CGI uses stdout for the finished product, it could have used stdin for
>> the input.
>
> Haven't used CGI in years, but I thought POST data came on stdin?
Yes. The user data is read via stdin.
On 2013-09-26, Steven D'Aprano wrote:
> On Wed, 25 Sep 2013 15:18:41 +, Grant Edwards wrote:
>
>>> The Referer is not an environment variable.
>>
>> It is when you're writing a CGI app.
>>
>>> How would your shell know what URL you were just browsing?
>>
>> Because the HTTP server sets thos
On 2013-09-26 04:25, Chris Angelico wrote:
On Thu, Sep 26, 2013 at 11:32 AM, Terry Reedy wrote:
Since CGI uses stdout for the finished product, it could have used stdin for
the input.
Haven't used CGI in years, but I thought POST data came on stdin?
You could just put the whole HTTP request
On Thu, Sep 26, 2013 at 11:32 AM, Terry Reedy wrote:
> Since CGI uses stdout for the finished product, it could have used stdin for
> the input.
Haven't used CGI in years, but I thought POST data came on stdin?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On 9/25/2013 8:11 PM, Steven D'Aprano wrote:
On Wed, 25 Sep 2013 15:18:41 +, Grant Edwards wrote:
The Referer is not an environment variable.
It is when you're writing a CGI app.
How would your shell know what URL you were just browsing?
Because the HTTP server sets those environment
On Wed, 25 Sep 2013 15:18:41 +, Grant Edwards wrote:
>> The Referer is not an environment variable.
>
> It is when you're writing a CGI app.
>
>> How would your shell know what URL you were just browsing?
>
> Because the HTTP server sets those environment variables before invoking
> the CGI
On Wed, 25 Sep 2013 18:16:39 +0300, Νίκος wrote:
> how caom the http_referer thing works ok now but when i just print all
> the key listing of .os.environ ket the http_referer key isnt inside?
That you do not understand this is caused by your failure to understand
the HTTP protocol. You have bee
Νίκος writes:
> Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
>> On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
>>> Hello, i decided am ong other os.environ variables to also grab the
>>> 'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
>>> complaining th
On 2013-09-25, ?? wrote:
> 25/9/2013 6:18 , ??/?? Grant Edwards :
>>> The Referer is not an environment variable.
>>
>> It is when you're writing a CGI app.
>>
>>> How would your shell know what URL you were just browsing?
>>
>> Because the HTTP server sets those
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> So you mean that even if i run it via shell this stement will also work
> because it happens to be in the same enviroment with the HTTP server?
No. Each process has its own environment. Your shell's environment
knows nothing about the web server's
Στις 25/9/2013 6:18 μμ, ο/η Grant Edwards έγραψε:
On 2013-09-25, Steven D'Aprano wrote:
On Wed, 25 Sep 2013 17:04:55 +0300, ?? wrote:
I would like to check for its existence and retrieve it if possible, if
its not there then default to the string "UnKnown Ref".
I try to do this with:
On 2013-09-25 18:16, Νίκος wrote:
> how caom the http_referer thing works ok now but when i just print
> all the key listing of .os.environ ket the http_referer key isnt
> inside?
Well, first off, it's entirely possible (based on reading that
paragraph) that you typed something wrong.
That said,
Στις 25/9/2013 6:14 μμ, ο/η Tim Chase έγραψε:
On 2013-09-25 18:02, Νίκος wrote:
This indeed works now:
ref = os.environ.get('HTTP_REFERER', 'Άγνωστο Ref')
but iam wondering why this doesnt work also:
ref = os.environ('HTTP_REFERER')
Shouldnt both work?
No...that calls os.environ. You like
On 2013-09-25, Steven D'Aprano wrote:
> On Wed, 25 Sep 2013 17:04:55 +0300, ?? wrote:
>
>> I would like to check for its existence and retrieve it if possible, if
>> its not there then default to the string "UnKnown Ref".
>>
>> I try to do this with:
>>
>> referer = os.environ.get('HTTP_
Στις 25/9/2013 6:04 μμ, ο/η Steven D'Aprano έγραψε:
On Wed, 25 Sep 2013 14:26:23 +, John Gordon wrote:
You could try this:
try:
referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
except KeyError:
referer = None
if not referer:
referer = 'Unknow
On 2013-09-25 18:02, Νίκος wrote:
> This indeed works now:
>
> ref = os.environ.get('HTTP_REFERER', 'Άγνωστο Ref')
>
> but iam wondering why this doesnt work also:
>
> ref = os.environ('HTTP_REFERER')
>
> Shouldnt both work?
No...that calls os.environ. You likely *mean*
ref = os.environ['H
Le mercredi 25 septembre 2013 17:02:45 UTC+2, Ferrous Cranus a écrit :
> Στις 25/9/2013 5:52 μμ, ο/η Steven D'Aprano έγραψε:
>
> > On Wed, 25 Sep 2013 17:04:55 +0300, Νίκος wrote:
>
> >
>
> >> I would like to check for its existence and retrieve it if possible, if
>
> >> its not there then defa
On 9/25/13 10:26 AM, John Gordon wrote:
You could try this:
try:
referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
except KeyError:
referer = None
if not referer:
referer = 'UnknownRef'
There's no need for the "except KeyError" clause. dict.get ne
On Wed, 25 Sep 2013 14:26:23 +, John Gordon wrote:
> You could try this:
>
> try:
> referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
> except KeyError:
> referer = None
> if not referer:
> referer = 'UnknownRef'
The get method will not raise KeyError
Στις 25/9/2013 5:52 μμ, ο/η Steven D'Aprano έγραψε:
On Wed, 25 Sep 2013 17:04:55 +0300, Νίκος wrote:
I would like to check for its existence and retrieve it if possible, if
its not there then default to the string "UnKnown Ref".
I try to do this with:
referer = os.environ.get('HTTP_REFERER',
On 2013-09-25 14:18, John Gordon wrote:
> However, if the user did not arrive from another page, then
> HTTP_REFERER will be missing. This happens when the user types the
> web address directly into their browser, or clicks on a bookmark,
> or many other ways.
>
> Also, obviously, it's up to the
On Wed, 25 Sep 2013 17:04:55 +0300, Νίκος wrote:
> I would like to check for its existence and retrieve it if possible, if
> its not there then default to the string "UnKnown Ref".
>
> I try to do this with:
>
> referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
>
> but that doesn't return
On Wed, 25 Sep 2013 17:07:38 +0300, Νίκος wrote:
> ni...@superhost.gr [~/www/cgi-bin]# python metrites.py
>File "metrites.py", line 27
> host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or
> 'UnKnown Host'
> ^
> SyntaxError: invalid syntax
>
>
> i dont see anything wr
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> But one other problem appeared too:
> ni...@superhost.gr [~/www/cgi-bin]# python metrites.py
>File "metrites.py", line 27
> host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or
> 'UnKnown Host'
> ^
> SyntaxError: invalid syn
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> referer = os.environ.get('HTTP_REFERER', 'UnknownRef')
> but that doesn't return anything either.
When you say it "doesn't return anything", what exactly do you mean? Does
it return None? Does it raise KeyError? Something else?
In any case, I'm su
On 2013-09-25 15:07, Νίκος wrote:
Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
complaini
In =?UTF-8?B?zp3Or866zr/Pgg==?=
writes:
> referrer = os.environ['HTTP_REFERER']
> Do i miss something? its a suprise to me that the environ dictioanry has
> almost anythign but a referrer key.
HTTP_REFERER is used to indicate the URL containing the link that led
the user to the current URL.
Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
complaining that 'HTTP_REFERER' didnt exist.
Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε:
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
complaining that 'HTTP_REFERER' didnt exist.
On Wed, Sep 25, 2013 at 2:45 PM, Νίκος wrote:
> Hello, i decided am ong other os.environ variables to also grab the
> 'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError
> complaining that 'HTTP_REFERER' didnt exist.
>
> So, to see what existed in the os.environ dictionary
Στις 25/9/2013 3:45 μμ, ο/η Νίκος έγραψε:
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a
KeyError complaining that 'HTTP_REFERER' didnt exist.
So, to see what existed in the os.environ dictionary i issues a p
Hello, i decided am ong other os.environ variables to also grab the
'HTTP_REFERER' fiel but when i try to run my script i was seeing a
KeyError complaining that 'HTTP_REFERER' didnt exist.
So, to see what existed in the os.environ dictionary i issues a print(
os.environ ) to see all available
35 matches
Mail list logo