Στις 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', 'UnknownRef')

but that doesn't return anything either.

Can you verify that its the correct way to grab the referral string?


The Referer is not an environment variable. How would your shell know
what URL you were just browsing?

Have you googled for HTTP Referer? Do you understand what it is?


Yes Steven googleign for 2 hours now.

You were rigth about the carret it was a synatx error above which i missed and i was breakign my head to the wall to understand what was wot with the 'host' variable. why python doestn detect the exact synxtax error and ispoitnign to me to another line making me think the error is elsewhere?

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?
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to