How to call a Web Service from Python with athentication

09-18-2019 07:27 AM
Occasional Contributor III

Hello everyone,

I am able to call a  HTTP web service from Python using urllib, urllib2.

But now I need to add authentication adding the UserID and Password in order to call the another service.

This is the existing code:

import arcpy, urllib, urllib2,

url = r''
values = {'myAddress' : '100 SW 10 street'}

data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page =
t = ET.fromstring(the_page)

Thank you

0 Kudos
0 Replies