There are a few changes that would need to be made here-
First, when using urllib2 to post, you'll need to urlencode the data (https://docs.python.org/2/howto/urllib2.html#data)
Secondly, base64.encodestring appears to be appending padding in some manner, you'll need to strip that out.
Lastly, you'll have to add the content type in the header to use the urlencoded data.
Something such as the following should work -
import urllib2
import base64
import urllib
def modify_perms( ss ):
url = "https://localhost:8089/servicesNS/%s/search/saved/searches/%s/acl" % ("admin", ss)
request = urllib2.Request( url )
base64string = base64.encodestring("admin:changeme").strip()
request.add_header("Authorization", "Basic %s" % base64string)
request.add_header("Referer", url )
request.add_header("Content-Type", "application/x-www-form-urlencoded")
kwargs = { "sharing" : "app","owner":"nobody" }
response = urllib2.urlopen( request , urllib.urlencode(kwargs))
print response.read()
modify_perms("test")
This is for a search named test in the search app changing the owner to "nobody" and sharing to "app".
... View more