chrome extension

542 views
Skip to first unread message

frederic kavita

unread,
May 20, 2017, 3:32:38 PM5/20/17
to brython
Hi everybody, 
There is an example of using brython to build a chrome extension

thnak you

Christophe BAL (via GMAIL)

unread,
May 20, 2017, 5:33:17 PM5/20/17
to bry...@googlegroups.com

Hello.


Is this a question or an affirmation ?

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/a4b81859-31ac-4a79-8d73-80c42b36e132%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Christophe BAL
Enseignant Agrégé de Mathématiques
Programmeur Python Amateur

frederic kavita

unread,
May 20, 2017, 6:12:03 PM5/20/17
to brython
question

frederic kavita

unread,
May 20, 2017, 6:44:44 PM5/20/17
to brython
brython.jpg

frederic kavita

unread,
May 21, 2017, 4:57:45 AM5/21/17
to brython
Christope j'ai l'impression que on peut utiliser brython que comme serveur avec chrome extension c'est le cas ?


Le samedi 20 mai 2017 23:33:17 UTC+2, Christophe Bal a écrit :

Christophe BAL (via GMAIL)

unread,
May 21, 2017, 4:13:37 PM5/21/17
to bry...@googlegroups.com

Veux -tu dire que l'on ne peut pas utiliser brython localement ?


For more options, visit https://groups.google.com/d/optout.

frederic kavita

unread,
May 22, 2017, 4:35:55 AM5/22/17
to brython
Oui en tout cas je n'ai pas trouver comment faire en local

Pierre Quentel

unread,
May 22, 2017, 3:42:36 PM5/22/17
to brython


Le lundi 22 mai 2017 10:35:55 UTC+2, frederic kavita a écrit :
Oui en tout cas je n'ai pas trouver comment faire en local

Le dimanche 21 mai 2017 22:13:37 UTC+2, Christophe Bal a écrit :

Veux -tu dire que l'on ne peut pas utiliser brython localement ?



Si, on peut utiliser Brython en local. Par contre Chrome ne supporte pas les appels Ajax faits en local, ce qui pose un problème pour les imports. La solution est de charger brython_stdlib.js dans la page, ou de créer un brython_modules.js à partir des scripts développés pour une application particulière (voir "implémentation de import" dans la documentation).

frederic kavita

unread,
May 22, 2017, 3:49:35 PM5/22/17
to brython
Tu peut donne un exemple stp

Pierre Quentel

unread,
May 22, 2017, 4:09:36 PM5/22/17
to bry...@googlegroups.com
<html>

<head>
<meta charset="utf-8">
</head>

<body onload="brython(1)">

<script type="text/python">
import datetime
print(datetime.datetime.now())
</script>

<script src="brython.js"></script>
<script src="brython_stdlib.js"></script>

</body>

</html>


--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+unsubscribe@googlegroups.com.

To post to this group, send email to bry...@googlegroups.com.

frederic kavita

unread,
May 22, 2017, 8:36:15 PM5/22/17
to brython
ok je vais teste
merci


Le lundi 22 mai 2017 22:09:36 UTC+2, Pierre Quentel a écrit :
<html>

<head>
<meta charset="utf-8">
</head>

<body onload="brython(1)">

<script type="text/python">
import datetime
print(datetime.datetime.now())
</script>

<script src="brython.js"></script>
<script src="brython_stdlib.js"></script>

</body>

</html>

Le 22 mai 2017 à 21:49, frederic kavita <amihaco...@gmail.com> a écrit :
Tu peut donne un exemple stp

Le lundi 22 mai 2017 21:42:36 UTC+2, Pierre Quentel a écrit :


Le lundi 22 mai 2017 10:35:55 UTC+2, frederic kavita a écrit :
Oui en tout cas je n'ai pas trouver comment faire en local

Le dimanche 21 mai 2017 22:13:37 UTC+2, Christophe Bal a écrit :

Veux -tu dire que l'on ne peut pas utiliser brython localement ?



Si, on peut utiliser Brython en local. Par contre Chrome ne supporte pas les appels Ajax faits en local, ce qui pose un problème pour les imports. La solution est de charger brython_stdlib.js dans la page, ou de créer un brython_modules.js à partir des scripts développés pour une application particulière (voir "implémentation de import" dans la documentation).

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.

To post to this group, send email to bry...@googlegroups.com.

frederic kavita

unread,
May 23, 2017, 4:34:39 PM5/23/17
to brython
il me sort une erreur 

  • Error

    Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:".

  • Error

    Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.


brython ligne 4888 = eval('$B.augm_item_'+augm_ops[i][1]+'='+augm_code)}

Pierre Quentel

unread,
May 23, 2017, 4:52:05 PM5/23/17
to brython


Le mardi 23 mai 2017 22:34:39 UTC+2, frederic kavita a écrit :
il me sort une erreur 

  • Error

    Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:".

  • Error

    Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.


brython ligne 4888 = eval('$B.augm_item_'+augm_ops[i][1]+'='+augm_code)}

J'ai testé sur Chrome en chargeant la page dans le navigateur, ça fonctionne. D'après le message d'erreur tu l'exécutes dans une extension Chrome, je n'y connais rien mais la réponse est peut-être ici.

frederic kavita

unread,
May 23, 2017, 4:57:10 PM5/23/17
to brython
Pour faire plus simple pierre,

J'ai un client qui veut que je lui construit une extension chrome anti phishing 

-Donc mon application ne va interargir que sur certaines adresse web :

je dois utilise une manifest.json du style : 


{
  "manifest_version": 2,
  "name": "vigilante phishing",
  "version": "0.1",
  "content_scripts": [
    {
      "matches": [
        "https://google.com/*"
      ],
      "js": ["jquery.js", "content.js"]
    }
  ]
}


j'aimerais utilise brython  pour gerer les events ,faires des alerts, envoie ajax coté server vers le framework web2py si possible sinon je peux tout coté de a à z mon systeme cote client
pas envie de le faire avec javascript ça fait plus d'1 ans que je code avec brython pas envie de me retaper du javascript   



Le lundi 22 mai 2017 22:09:36 UTC+2, Pierre Quentel a écrit :
<html>

<head>
<meta charset="utf-8">
</head>

<body onload="brython(1)">

<script type="text/python">
import datetime
print(datetime.datetime.now())
</script>

<script src="brython.js"></script>
<script src="brython_stdlib.js"></script>

</body>

</html>

Le 22 mai 2017 à 21:49, frederic kavita <amihaco...@gmail.com> a écrit :
Tu peut donne un exemple stp

Le lundi 22 mai 2017 21:42:36 UTC+2, Pierre Quentel a écrit :


Le lundi 22 mai 2017 10:35:55 UTC+2, frederic kavita a écrit :
Oui en tout cas je n'ai pas trouver comment faire en local

Le dimanche 21 mai 2017 22:13:37 UTC+2, Christophe Bal a écrit :

Veux -tu dire que l'on ne peut pas utiliser brython localement ?



Si, on peut utiliser Brython en local. Par contre Chrome ne supporte pas les appels Ajax faits en local, ce qui pose un problème pour les imports. La solution est de charger brython_stdlib.js dans la page, ou de créer un brython_modules.js à partir des scripts développés pour une application particulière (voir "implémentation de import" dans la documentation).

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.

To post to this group, send email to bry...@googlegroups.com.

Pierre Quentel

unread,
May 24, 2017, 5:10:50 AM5/24/17
to brython


Le mardi 23 mai 2017 22:57:10 UTC+2, frederic kavita a écrit :
Pour faire plus simple pierre,

J'ai un client qui veut que je lui construit une extension chrome anti phishing 

-Donc mon application ne va interargir que sur certaines adresse web :

je dois utilise une manifest.json du style : 


{
  "manifest_version": 2,
  "name": "vigilante phishing",
  "version": "0.1",
  "content_scripts": [
    {
      "matches": [
        "https://google.com/*"
      ],
      "js": ["jquery.js", "content.js"]
    }
  ]
}


j'aimerais utilise brython  pour gerer les events ,faires des alerts, envoie ajax coté server vers le framework web2py si possible sinon je peux tout coté de a à z mon systeme cote client
pas envie de le faire avec javascript ça fait plus d'1 ans que je code avec brython pas envie de me retaper du javascript   

D'après le lien sur stackoverflow, il faut ajouter ceci dans ton manifest.json :

"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"

 
Reply all
Reply to author
Forward
0 new messages