By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,525 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,525 IT Pros & Developers. It's quick & easy.

Using python from a browser

P: n/a
Hi,

I have a python script I wish to call from various browsers (IE; Mozilla,
Firefox ..) on Windows & Linux.
I read that IE had the capability to embedd Python scripts, but what about the
others ?

Regards,

Philippe

--
*************************************
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************************************
Jul 19 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Philippe C. Martin a écrit :
Hi,

I have a python script I wish to call from various browsers (IE; Mozilla,
Firefox ..) on Windows & Linux.
What do you mean ? Is that a client-side or server-side script ?
I read that IE had the capability to embedd Python scripts,


Where ?
Jul 19 '05 #2

P: n/a
Hi,
What do you mean ? Is that a client-side or server-side script ?
Client side

Where ?

Programming Python - O'Reilly - 2nd edition - by Mark Lutz - Paragraph
"Teaching IE about Python" - Pages 922-925

Regards,

Philippe

Jul 19 '05 #3

P: n/a
Hi !

I confirm for IE. Others, I don't know.

@-salutations

Michel Claveau


Jul 19 '05 #4

P: n/a
Philippe:
I read that IE had the capability to embedd Python scripts, but what
about the others ?


While Python can be set up as a scripting language for IE, this is
normally disabled as it could be a security hole. The open call is
available from Python scripts so a web site could read or destroy your
files.

Neil
Jul 19 '05 #5

P: n/a
Since I need to access a local/client device from the page and that I wish
to be cross-platform; does that mean Java is my only way out ?

Regards,

Philippe

Neil Hodgson wrote:
Philippe:
I read that IE had the capability to embedd Python scripts, but what
about the others ?


While Python can be set up as a scripting language for IE, this is
normally disabled as it could be a security hole. The open call is
available from Python scripts so a web site could read or destroy your
files.

Neil


Jul 19 '05 #6

P: n/a
Philippe:
Since I need to access a local/client device from the page and
that I wish to be cross-platform; does that mean Java is my only
way out ?


Java is designed to be safe and not allow access to client devices.
There is a mechanism where you can attempt to ask for permission from
Java but it looked complex to me and I doubt many browsers will
cooperate. They have often locked security down to prevent this sort of
access.

Neil
Jul 19 '05 #7

P: n/a
Philippe C. Martin wrote:
Hi,

What do you mean ? Is that a client-side or server-side script ?

Client side
So I can't help you...
Where ?


Programming Python - O'Reilly - 2nd edition - by Mark Lutz - Paragraph
"Teaching IE about Python" - Pages 922-925

Thanks, I'll have a look one day.

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Jul 19 '05 #8

P: n/a
Philippe C. Martin wrote:
Since I need to access a local/client device from the page and that I wish
to be cross-platform; does that mean Java is my only way out ?


Or you could try Jython (http://www.jython.org/).

--
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton

Roel Schroeven
Jul 19 '05 #9

P: n/a
Neil,

Would Jpython let me do that ?
Would java let me call an external Python script - which in turn would
access my device ?

Thanks

Philippe

Neil Hodgson wrote:
Philippe:
Since I need to access a local/client device from the page and
that I wish to be cross-platform; does that mean Java is my only
way out ?


Java is designed to be safe and not allow access to client devices.
There is a mechanism where you can attempt to ask for permission from
Java but it looked complex to me and I doubt many browsers will
cooperate. They have often locked security down to prevent this sort of
access.

Neil


Jul 19 '05 #10

P: n/a
I'll take a lok, thanks

Roel Schroeven wrote:
Philippe C. Martin wrote:
Since I need to access a local/client device from the page and that I
wish to be cross-platform; does that mean Java is my only way out ?


Or you could try Jython (http://www.jython.org/).


Jul 19 '05 #11

P: n/a
I don't think Jython will help much here... you would have to embed
jython in your applet which makes it big, which makes it take longer
to download... (or you could install it ahead of time on each client.)

I asked my friend who did some smartcard authentication at a previous
job... and in his case the card had an LCD readout that gave a
different key every minute, and the user had to look at that number,
and type it in for access. To automate this, with a card reader,
there could be a (barcoder-scanner-like) app on each client that would
emulate typing on the keyboard when the card was read. The user would
have to click on a text field, then scan their card and the number
would show up automatically. One step further... some javascript
could possibly get the keyboard events as long as the page had input
focus, and if it sees a smart-card key like sequence of keystrokes,
then submit a form from a hidden IFrame....

So, short of writing your own plug-in extension for each different
browser, I'm not sure you're going to be able to access the client
hardware from a client-side web page. Either way (plug-in or java
applet with privileges) your user will have to agree to give access to
the hardware.

-Jim

On 4/15/05, Philippe C. Martin <ph******@philippecmartin.com> wrote:
Neil,

Would Jpython let me do that ?
Would java let me call an external Python script - which in turn would
access my device ?

Thanks

Philippe


Neil Hodgson wrote:
Philippe:
Since I need to access a local/client device from the page and
that I wish to be cross-platform; does that mean Java is my only
way out ?


Java is designed to be safe and not allow access to client devices.
There is a mechanism where you can attempt to ask for permission from
Java but it looked complex to me and I doubt many browsers will
cooperate. They have often locked security down to prevent this sort of
access.

Neil


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

Jul 19 '05 #12

P: n/a
Thanks Jim,

From all I hear, it looks like the client authentication will have tobe made
"on the side of the browser", between the server and a specific program
running on the client. Not as nice but ....

Regards,

Philippe


On Friday 15 April 2005 08:52 am, James Carroll wrote:
I don't think Jython will help much here... you would have to embed
jython in your applet which makes it big, which makes it take longer
to download... (or you could install it ahead of time on each client.)

I asked my friend who did some smartcard authentication at a previous
job... and in his case the card had an LCD readout that gave a
different key every minute, and the user had to look at that number,
and type it in for access. To automate this, with a card reader,
there could be a (barcoder-scanner-like) app on each client that would
emulate typing on the keyboard when the card was read. The user would
have to click on a text field, then scan their card and the number
would show up automatically. One step further... some javascript
could possibly get the keyboard events as long as the page had input
focus, and if it sees a smart-card key like sequence of keystrokes,
then submit a form from a hidden IFrame....

So, short of writing your own plug-in extension for each different
browser, I'm not sure you're going to be able to access the client
hardware from a client-side web page. Either way (plug-in or java
applet with privileges) your user will have to agree to give access to
the hardware.

-Jim

On 4/15/05, Philippe C. Martin <ph******@philippecmartin.com> wrote:
Neil,

Would Jpython let me do that ?
Would java let me call an external Python script - which in turn would
access my device ?

Thanks

Philippe

Neil Hodgson wrote:
Philippe:
> Since I need to access a local/client device from the page and
> that I wish to be cross-platform; does that mean Java is my only
> way out ?

Java is designed to be safe and not allow access to client devices.
There is a mechanism where you can attempt to ask for permission from
Java but it looked complex to me and I doubt many browsers will
cooperate. They have often locked security down to prevent this sort of
access.

Neil


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


--
*************************************
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************************************
Jul 19 '05 #13

P: n/a
> > I read that IE had the capability to embedd Python scripts, but what
about the others ?


While Python can be set up as a scripting language for IE, this is
normally disabled as it could be a security hole. The open call is
available from Python scripts so a web site could read or destroy your
files.


Slightly off-topic, it is possible to use browser helper objects
(bhos) with Internet Explorer:

http://starship.python.net/crew/thel...gi/CtypesLinks

Marcus
Jul 19 '05 #14

P: n/a
On Fri, 15 Apr 2005 09:52:41 -0400, James Carroll <mr*****@gmail.com> wrote:
I don't think Jython will help much here... you would have to embed
jython in your applet which makes it big, which makes it take longer
to download... (or you could install it ahead of time on each client.)

I asked my friend who did some smartcard authentication at a previous
job... and in his case the card had an LCD readout that gave a
different key every minute, and the user had to look at that number,
and type it in for access. To automate this, with a card reader,
there could be a (barcoder-scanner-like) app on each client that would
emulate typing on the keyboard when the card was read. The user would
have to click on a text field, then scan their card and the number
would show up automatically. One step further... some javascript
could possibly get the keyboard events as long as the page had input
focus, and if it sees a smart-card key like sequence of keystrokes,
then submit a form from a hidden IFrame....

So, short of writing your own plug-in extension for each different
browser, I'm not sure you're going to be able to access the client
hardware from a client-side web page. Either way (plug-in or java
applet with privileges) your user will have to agree to give access to
the hardware.

-Jim I wonder if anyone has written a safe proxy for this kind of purpose,
so that any browser would see just ordinary html at a particular url
but would then be viewing html either passed through from a particular
server or synthesized for for the local access part, which it could
do arbitrarily, depending on its user/privilege status.

[BTW, note reason why top-posts scramble things eventually. Please reconsider ;-)]

On 4/15/05, Philippe C. Martin <ph******@philippecmartin.com> wrote:
Neil,
=20
Would Jpython let me do that ?
Would java let me call an external Python script - which in turn would
access my device ?
=20
Thanks
=20
Philippe
=20
=20
Neil Hodgson wrote:
=20
> Philippe:
>
>> Since I need to access a local/client device from the page and
>> that I wish to be cross-platform; does that mean Java is my only
>> way out ? See comment above.
>
> Java is designed to be safe and not allow access to client devices.
> There is a mechanism where you can attempt to ask for permission from
> Java but it looked complex to me and I doubt many browsers will
> cooperate. They have often locked security down to prevent this sort of
> access.
>
> Neil

=20
--
http://mail.python.org/mailman/listinfo/python-list
=20


Regards,
Bengt Richter
Jul 19 '05 #15

P: n/a
Philippe:
Would Jpython let me do that ?
Would java let me call an external Python script - which in turn would
access my device ?


Not without asking for more permissions than accessing the device as
being able to execute arbitrary code is very dangerous. Think of this
from the point of view of someone trying to stop malicious code from
executing because of visiting a web page. There are various ways to
install code that can be called from web pages such as installing COM
objects or writing browser extensions but you will have to get the user
to allow these and they may not have permission to do so. Often they
won't know how to allow this so you will have to write up detailed
instructions after exploring the area thoroughly yourself.

Neil
Jul 19 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.