Closed RandySincoular closed 8 years ago
@RandySincoular I've faced similar problems using ArcREST inside networks with proxy as well. I'm using a workaround here forcing proxy through Python environment variables.
Here is the code that I'm using:
def set_proxy_environment_variables():
proxies = urllib.getproxies()
http_proxy = proxies.get('http')
https_proxy = proxies.get('https')
Utils.logs("Proxies: {0}".format(proxies))
if http_proxy is not None and http_proxy != "":
Utils.logs("Configurando http proxy: {0}".format(http_proxy))
os.environ["HTTP_PROXY"] = http_proxy
if https_proxy is not None and https_proxy != "":
Utils.logs("Configurando https proxy: {0}".format(https_proxy))
os.environ["HTTPS_PROXY"] = https_proxy
I hope it helps.
Thanks Bruno, that should do the trick. I appreciate your help.
Randy
From: Bruno Caimar [mailto:notifications@github.com] Sent: Friday, April 29, 2016 1:53 PM To: Esri/ArcREST Cc: Sincoular, Randy; Mention Subject: Re: [Esri/ArcREST] Question about Using a Proxy Server with ArcREST Samples (#228)
@RandySincoularhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_RandySincoular&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=ssSqFGImqpL14ItF60bQ9aXxBgECVpzGAWSt-IHfBbo&s=wl3fSMSkNEBNpLiRfkEURXLThbVLRmOcfIra_Muhw8M&e= I've faced similar problems using ArcREST inside networks with proxy as well. I'm using a workaround here forcing proxy through Python environment variables.
Here is the code that I'm using:
def set_proxy_environment_variables():
proxies = urllib.getproxies()
http_proxy = proxies.get('http')
https_proxy = proxies.get('https')
Utils.logs("Proxies: {0}".format(proxies))
if http_proxy is not None and http_proxy != "":
Utils.logs("Configurando http proxy: {0}".format(http_proxy))
os.environ["HTTP_PROXY"] = http_proxy
if https_proxy is not None and https_proxy != "":
Utils.logs("Configurando https proxy: {0}".format(https_proxy))
os.environ["HTTPS_PROXY"] = https_proxy
I hope it helps.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Esri_ArcREST_issues_228-23issuecomment-2D215847222&d=CwMCaQ&c=GUDVeAVg1gjs_GJkmwL1m3gEzDND7NeJG5BIAX_2yRE&r=VPwuEa_rNmp_UVm0od-YvdtKnlNWqqwbpxa2Pz1fNVE&m=ssSqFGImqpL14ItF60bQ9aXxBgECVpzGAWSt-IHfBbo&s=zhLjYnhDyAEqXRBetQo1rHnGFxqKX4mCV0or35LjVa4&e=
Hello,
May I know in what part of the script should we put it? As you see in the script provided by Randy that it uses specific variable namely the proxy_port
and proxy_url
?
We are also working with arcRest and we are encountering the 407 Proxy Authentication Required error. I already setup the HTTPS_PROXY
and HTTP_PROXY
in the environment variables and we using the user's windows id.
Any help would be very much appreciated.
Hi @ScrollLock,
You have to set the proxy variables before any call to ArcREST. Usually I do that at the first thing on my scripts.
You can try to set proxy url with the username/password to try to bypass the 407 error message. It will be something like:
os.environ["HTTP_PROXY"] = "DOMAIN\User_Name:Passw0rd123@PROXY_SERVER_NAME_OR_IP:PORT"
os.environ["HTTPS_PROXY"] = "DOMAIN\User_Name:Passw0rd123@PROXY_SERVER_NAME_OR_IP:PORT"
Using http with Python on Windows it's a bit annoying. Sometimes it works without user/pwd and sometimes it does not.
Bruno
ArcRest or ArcRestHelper
Both?
Version or date of download
18-Apr-16
### Bug or Enhancement Question: I have a script based on the adds_rows.py sample that reads records from a local FGDB and is supposed to update a feature layer we have in AGOL. This script works from a network connection outside of our company, but inside our network the script fails.
Our firewall group is telling me that the script is not using our proxy server but going directly to our firewall where it is being blocked. They also said that there appears to be traffic taking two paths to get to the internet. One path is going through our firewall and another is trying to go through our proxy. Not sure if I understand this. they have checked firewall rules, run firewall debug sessions, etc. No luck so far.
Is there something else I should be doing to set the proxy_url or am I missing something else? Or, is there something else our firewall group should be looking at?
Thanks,
Randy
Repo Steps or Enhancement details
""" This sample shows how to add rows from a FGDB to an AGOL layer
""" import arcrest from arcresthelper import featureservicetools from arcresthelper import common
def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback, inspect,sys tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] filename = inspect.getfile(inspect.currentframe())
script name + line number
def main():
Use these settings when running inside of XXXXX Network
if name == "main": main()
*There are 2 features in the local FGDB.
Error:
* Remote Interpreter Reinitialized *