Closed adamkerz closed 8 years ago
@adamkerz I'll take a look at it today.
Just committed a fix. Please pull the latest.
import arcrest
if __name__ == "__main__":
username = "username"
password = "password"
referer = "mysite.someotherpart.com"
org_url = "https://mysite.someotherpart.com/arcgis"
url = "https://mysite.someotherpart.com/arcgis/rest/services/SampleWorldCities/MapServer"
sh = arcrest.AGSTokenSecurityHandler(username, password, org_url=org_url)
sh.referer_url = referer
ms = arcrest.ags.MapService(url=url, securityHandler=sh, initialize=True)
print ms.capabilities
I've forked ArcREST on the 20th April (
db5f57304f5c20e9855c5f60e5eafe23e3476106
) and am trying to useAGSTokenSecurityHandler
with a referer based token and aGPTask
. Unfortunately, although it retrieves a token correctly, it looks like it does not add thereferer
header to the submit job request.I'm currently hacking it to get my POC working, but, firstly, wondering if I've missed something, as it looks like it's been implemented for the
PortalTokenSecurityHandler
, butAGSTokenSecurityHandler
seems to be hard coded torequestip
. Secondly, is this something that you could easily implement? I'm writing some pretty hacky code to get it working, probably partly because I'm struggling to understand the class hierarchy, and there appears to beurllib
handlers and then ArcREST handlers, which I think are different things...I'm happy to implement it if you can give me some guidance as to the best way, but my current code really isn't that great.
Cheers,
Adam