Getting request's source site

Joel Goldstick joel.goldstick at gmail.com
Mon Aug 26 11:16:01 EDT 2013


On Mon, Aug 26, 2013 at 11:03 AM, Guy Tamir <guytamir1 at gmail.com> wrote:
> On Monday, August 26, 2013 5:25:49 PM UTC+3, Steven D'Aprano wrote:
>> On Mon, 26 Aug 2013 06:10:41 -0700, Guy Tamir wrote:
>>
>>
>>
>> > Hi all,
>>
>> >
>>
>> > I was wondering how i can get the source from which the request came
>>
>> > from. If a user posted a link that directs to my server on facebook i'd
>>
>> > like to know that a specific click was from facebook or twitter etc..
>>
>>
>>
>> That would be the "referer" header in the HTTP request. (Note that it is
>>
>> an accidental misspelling of "referrer".) Including a referrer is not
>>
>> compulsory, so be prepared for it not to be available.
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>> Steven
>
> Thanks for reply,
> In what cases will i have this header? is there something i can do to enforce having it?
> Are there any other ways?
> --

You can look in the server logs if you have them available.  If the
visitor supplied a referer value in the header, it will be in the log.
 You don't have any say in this from your end.

If you are the creator of your own website you might like to add
google analytics to your pages.  This is done with a little javascript
that google provides.

Although there may be a python angle to your question, it isn't apparent yet.


> http://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com



More information about the Python-list mailing list