Select to view content in your preferred language

Authentication Warning - Unverified HTTPS request is being made to host

2991
7
Jump to solution
01-10-2025 12:01 PM
Labels (2)
tiztrain
Frequent Contributor

Hey all,

I am currently working on a Python script and when I authenticate into AGOL I have no issues until I run certain queries and then I get:

'InsecureRequestWarning: Unverified HTTPS request is being made to host 'PORTALNAME.maps.arcgis.com'. Adding certificate verification is strongly advised.'

This specifically occurs when I add the max_item parameter in the gis.content.search method.

As an example, if I run the following, I get no warning:

wm_items = gis.content.search(query=query)

If I add that parameter, then the warning appears:

wm_items = gis.content.search(query=query, max_items=10000) 

tiztrain_0-1736538889748.png

I authenticated using the GIS(api_key='...', referer='https') method.

Any help would be appreciated.

 

1 Solution

Accepted Solutions
JordanCarmona
Occasional Contributor
7 Replies
CodyPatterson
MVP Regular Contributor

Hey @tiztrain 

This is just a warning currently, and shouldn't prevent you from running queries, I may have missed you saying that though. If you'd like to silence them, you can use the URLLIB library to do something like this here:

import warnings
from urllib3.exceptions import InsecureRequestWarning

warnings.simplefilter("ignore", InsecureRequestWarning)

On the end of your GIS connection string you can also try to add verify_cert=True.

I would try reducing the amount of max items as well, could be something happening there.

Cody

tiztrain
Frequent Contributor

Thanks for getting back to me so quickly @CodyPatterson 

It seems to not have prevented me from doing anything but I am cleaning up my code now and wanted to resolve this issue. I did see that I could hide it but was thinking that this message might be important and thought it was indicating that I was doing something wrong.

I was also wondering if reducing the max_items would fix it but even when I put it to 1, still got the same issue.

Tried auth by using what you suggested. Tell me if I am using it wrong but did the following but unfortunately that did not help:

GIS(api_key='...', referer='https', verify_cert=True) 

0 Kudos
chris_del101
Regular Contributor

I am getting these warnings also

0 Kudos
JordanCarmona
Occasional Contributor
tiztrain
Frequent Contributor

Oh good to know. Will just ignore these for now

chris_del101
Regular Contributor

But how to ignore them? I mean ingnore in python. I know how to ignore warnings in python, but how for this case?

This post  user says the same thing, and I ask the say question (but give an example of what I tried).  🙂

0 Kudos
tiztrain
Frequent Contributor
import warnings
from urllib3.exceptions import InsecureRequestWarning

warnings.simplefilter("ignore", InsecureRequestWarning)
print ('Warnings have been silenced')
0 Kudos