Usings requests to detect broken links

319
2
04-16-2020 11:56 AM
DaveSivertsen
New Contributor III

Just getting started with AGOL Notebooks. Working through the example for detecting broken links. It works great for resources on our AGOL site, but request() fails when attempting to access feature services provided by ArcServer 10.7.1 on an AWS platform.

requests.get('https://arc.g****r.net:6443/arcgis/rest/services/OperationalLayers/PCII/FeatureServer/0', verify=False)

The AWS Server is a one-off, not running webadaptor - HTTPS GIS traffic goes to port 6443. The security certificate is current and valid for the host name. Entering the URL directly in a browser loads the ArcGIS REST Services Directory page and shows it as secure. 

Running python2.7 directly on a PC, this request succeeds, although it warns of an insecure request.

In the AGOL Notebook setting, the request eventually fails with a timeout error.

ConnectionError: HTTPSConnectionPool(host='arc.g****r.net', port=6443): Max retries exceeded with url: /arcgis/rest/services/OperationalLayers/PCII/FeatureServer/0 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3c1b51e630>: Failed to establish a new connection: [Errno 110] Connection timed out',))

Suggestions?

0 Kudos
2 Replies
DaveSivertsen
New Contributor III

Update: Current hypothesis is there are outbound rules blocking on arcgis.com. Sample notebook for requests only work on arcgis.com domain/subdomain - timeout errors otherwise. Sample notebook for notification does not send on a range of smtp servers.

If I download these sample notebooks to my PC, run them with the jupyter-notebook.exe installed with arcgis pro, and change arcgis('Home') to point to our AGOL site - they both work.

Convenient to have notebooks as part of AGOL, but kind of broken if they can't do requests or email.

0 Kudos
DaveSivertsen
New Contributor III

An additional note. Using requests to detect broken links is somewhat flawed. It operates on the notion that a good link will return 200 and a bad one 404- unreachable. Map links are commonly "broken" by updating a map or tiles., In this case, the webmap will not load, but the link will return 200 as valid, with a message from the services directory that the service is not available.

0 Kudos