Halo, I need to develop a Google extension that able to link with python. I already write the process code in the python, all I need is a extension that can scrape the Twitter ID and Tweet, and process through the python and send back the result from python to extension. Is it posible? What library need to use? It will something like pass messages between the extension and python program.
You can try using a python interpreter implemented in javascript, like Brython for example.
Another option is to create a python web server that listens for requests with twitter ids and responds with the processed information. Your extension will then communicate with the python server same as any other api server.
Related
I need to run Python script without external dependencies so I can not use SDK for python. I also do not want call external tools like sentry-cli from script for that purpouse
I need simply send two events to specific Project, using DSN.
I can not google it or find in API reference(there only methods about listing\retrivieng issues/events but not sending them)
So my question is how to send event to sentry project using DSN?
The same way any of the SDKs does: post the data to Sentry API for the given DSN. There are multiple sources you can use to build that:
read up on Sentry SDK development docs: https://develop.sentry.dev/sdk/envelopes/
have a look into Sentry python SDK source code to see what's going on and reimplement the pieces you need (keep the code license in mind): https://github.com/getsentry/sentry-python
Try the Sentry JavaSCript SDK and post an even through browser devtools console, then you can see the exact payload on the network tab.
I want to run a python file in the web I have in a GitHub repository. Is it possible to do this?
And by running in the web, I mean putting #!/usr/bin/python and print 'Content-type:text/html\n in the first two lines.
In general this is not possible, Github (pages) serves only static content (ex: HTML, CSS, JS). If you want python to run (ex generate dynamic content) you need a web server capable of running python (your browser were the contents of GitHub Pages get downloaded and run can't do it).
That said there are experimental ways of running subsets of python in the browser. Take a look for a example at this question.
If you truly want to generate a complete HTTP response via standard output, then start by reading about CGI and Python's standard cgi module. You'll also need to have access to a CGI-compatible web server, perhaps running on a virtual host.
However, CGI is quite obsolescent as a way to produce dynamic output for the web. #jjwon's suggestion to look at Python-based web application frameworks like Flask is a good one.
I have a website with miniwebhost.com, which supports python. I want to have a page that runs one of my text based games I have made on Python. So, how would I go about doing it? I know I have to make it executable and something about a cgi-bin(which I have). Put your answer in clear steps please.
Site is: www.rosshudson.co.uk/
Python web applications are often hooked to the web server (e.g. Apache httpd) using the WSGI module. Note that your app need to handle the HTTP requests correctly either by using a framework (like Django) or the BaseHttpServer, BaseHttpRequestHandler from the standard library.
I have a question regarding writing Desktop applications in Python using the Soundcloud API. My problem is how can I implement a login functionality in my Desktop application without disclosing my client Secret. Because in order to get a login token I need to initialize the client with my client ID and secret. Is it possible somehow? Or do I have to use the Java or Objective-C API?
Or is it save to create Python bytecode and than publish my application? I haven't much experience with Python bytecode. Is it possible to extract variables or constants from the *.pyc file?
My goal is to use to make it easy for non-programmers to execute a Python script with fairly complex options, on a single local machine that I have access to. I'd like to use the browser (specifically Safari on OS X) as a poor man's GUI. A short script would process the form data and then send it on to the main program(s).
I have some basic examples of python scripts run using the built-in Apache server, by clicking submit on a form whose html is th:
e.g. here. What I want to do now is do it without the server, just getting the form to invoke the script in the same directory. Do I have to learn javascript or ...? I'd be grateful for any leads you have. Thanks.
It doesn't make sense -- what a browser does when it submits a form by definition is to make a request to a web server.
If all that's going on is that you don't want to be running Apache, you could hook something simple up using the CGIHTTPServer class that's provided as part of the Python Standard library.
If you don't want a server process at all, and you're using a suitably modern browser, you may want to look at using HTML5 local storage, but that's not a Python solution.
Well, there always has to be some kind of "server" involved to communicate over HTTP. You could have a python script listening on port 80 on your machine, that in turn runs the scripts specified with the form's action attribute.
You won't get away without some sort of server, I'm afraid.
PS: There are already a couple of good minimalistic python HTTP servers that would do the trick. Just google for it.
Regards, aefxx
Pyjamas Desktop will allow you to deploy a browser-based desktop application.