python ignores environmet proxy settings - python

I am currently using python to write some appium test. Because I am behind a corporate firewall my traffic needs to go via a proxy.
I have set my http_proxy and https_proxy variables, but it seems like this is not being picked up by python during execution.
I tried the exact same test using javascript and node and the proxy get picked up and everything works so I am sure the problem is python not following the proxy settings.
How can I make sure python is using correct proxy settings?
I am using python 2.7 on macos mojave
Thanks!

So I figured out that appium currently does not support options to provide a proxy when making a remote connection. As temporary solution I modified the remote_connection module of selenium that appium inherits forcing it to use a proxy url for the connection.
My python knowledge is not that good but I think it shoudnt take much effort for someone to make a module that wraps/override the appium webdriver remote connection to include a proxy option.

Related

Using a server to run tasks with Selenium Webdriver

Background
I have built a chrome extension to run tasks automatically with python and selenium on my localhost.
I would like to use my extension on my smartphone (with a different network). For this, I just need to use a specific browser and its running well
The Problem
In order for my extension to work on a different device, I need a server to receive a request passing all the information to start the job.
The API is done, but I don't know how to proceed with the server part.
What I've Tried
I tried to host on Heroku, it's working and I can receive requests, but web-driver isn't working. To being headless and the server is located in Europe, the website is blocking my access to the content.
Also, I tried to use a proxy, but I need authentication, but that doesn't work with selenium.
Further Explanation
Basically, I need to enable my chrome extension to do a request directly to my personal computer or use a server with a graphical user interface to set-up the proxy manually, but I don't have any idea how to proceed with this or if that is even the best option.
Any thoughts about a good work around?

Discover python service in go

I currently have a http server implemented in python using flask. The service is registered using the zeroconf module:
info = ServiceInfo('_http._tcp.local.',
'MyServer._http._tcp.local.',
inet_aton(host), port, properties={})
zc = Zeroconf()
zc.register_service(info, allow_name_change=True)
Also, I have a go application browsing the available services using zeroconf. The problem is that if I start the go program after the python server the go program never discovers the server. If I start the go program first there's no issue. I even try extending the ttl on the register_service function with no results.
I'm trying that the go program discovers the python servers that where already running when it gets started.
I recently discover that the go part functions perfectly, I register the service using avahi-publish and go discover it correctly. So I guess the python module is the problem. I know now that I can run avahi but I would like a python implementation of the protocol, having dependencies only in python.

Looking for solution to manually control automated selenium driver on linux server

So, I have multiple selenium chrome drivers doing automated tasks with python on multiple linux servers. 99% of the tasks is automated until it runs into situations that require human involvement.
I am currently using VNC to connect to my linux server and control the chrome but I am not enjoying at all.
I am simply trying to find a better solution.
Thanks!
EDIT:
To be more specific, since the chrome drives sometimes need to be controlled by other people and I actually don't want third-party to connect to my server with VNC.
I have actually tried to re-direct the whole browsing session to local PC when human control is needed (like what proxy servers do) but I didn't succeed.

What is the best way to let someone test your webapp

I've been creating an webapp (just for learning purposes) using python django, and have no intention in deploying it. However, is there a way to let someone else, try the webapplication, or more precisely: Is it possible to somehow test the webapp on another computer. I tried to send det source code (and the whole folder), to another computer, installed virtual environment, activated it, and tried to runserver. However, I always get runtimeerror:maximum recursion depth exceeded in cmp. Is there any other way around it?
You can use ngrok -- https://ngrok.com/ -- to create a public URL to your local server for testing, and then give that URL to people so they can try your webapp.
You can also use Localtunnel to easily share a web service on your local development without deploying the code in the server.
Install the localtunnel
npm install -g localtunnel
Start a webserver on some local port (eg http://localhost:8000) and use the command line interface to request a tunnel to your local server
lt --port 8000
You will receive a url, for example https://xyz.localtunnel.me, that you can share with anyone for as long as your local instance of lt remains active. Any requests will be routed to your local service at the specified port.

Host a Python based Websocket server

I am looking to host a basic Websocket server.
The code I want to see running is : FastFlicker
Do you know how and where I can host this application online?
PythonAnywhere dev here. Unfortunate we can't host websocket-based apps on our site right now. The toggle you spotted enables/disables websockets for our in-browser consoles, it's not related to running your own websocket server.
I've added an upvote for websockets to our own issue tracker, but for now you'll have to use a different service :-(
Your solution is OpenShift, even with the free plan you can host FastFlicker.
Click Add Application, choose the good cartridges (Python 2.7).
Then use your gitHub repo url to get the source.
Once the application is running, you need to SSH it to change the address and the port (see this Post).
To be able to ssh you need first to generate a ssh key and to add it in setting on the website
Ok, now kill all processes that uses your port. (lsof -i :8080)
Start your application and now it's working!
(It is in app-deployments/current/repo/ for me, then python FastFlicker.py &)
It is currently hosted here : ws://main-fastflicker.rhcloud.com:8000/
And to test it, you know you can use this generic client..

Categories