idx
int64
0
252k
question
stringlengths
48
5.28k
target
stringlengths
5
1.23k
245,900
def featureServers ( self ) : if self . urls == { } : return { } featuresUrls = self . urls [ 'urls' ] [ 'features' ] if 'https' in featuresUrls : res = featuresUrls [ 'https' ] elif 'http' in featuresUrls : res = featuresUrls [ 'http' ] else : return None services = [ ] for urlHost in res : if self . isPortal : servic...
gets the hosting feature AGS Server
245,901
def update ( self , updatePortalParameters , clearEmptyFields = False ) : url = self . root + "/update" params = { "f" : "json" , "clearEmptyFields" : clearEmptyFields } if isinstance ( updatePortalParameters , parameters . PortalParameters ) : params . update ( updatePortalParameters . value ) elif isinstance ( update...
The Update operation allows administrators only to update the organization information such as name description thumbnail and featured groups .
245,902
def updateUserRole ( self , user , role ) : url = self . _url + "/updateuserrole" params = { "f" : "json" , "user" : user , "role" : role } return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
The Update User Role operation allows the administrator of an org anization to update the role of a user within a portal .
245,903
def isServiceNameAvailable ( self , name , serviceType ) : _allowedTypes = [ 'Feature Service' , "Map Service" ] url = self . _url + "/isServiceNameAvailable" params = { "f" : "json" , "name" : name , "type" : serviceType } return self . _get ( url = url , param_dict = params , securityHandler = self . _securityHandler...
Checks to see if a given service name and type are available for publishing a new service . true indicates that the name and type is not found in the organization s services and is available for publishing . false means the requested name and type are not available .
245,904
def servers ( self ) : url = "%s/servers" % self . root return Servers ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
gets the federated or registered servers for Portal
245,905
def users ( self , start = 1 , num = 10 , sortField = "fullName" , sortOrder = "asc" , role = None ) : users = [ ] url = self . _url + "/users" params = { "f" : "json" , "start" : start , "num" : num } if not role is None : params [ 'role' ] = role if not sortField is None : params [ 'sortField' ] = sortField if not so...
Lists all the members of the organization . The start and num paging parameters are supported .
245,906
def roles ( self ) : return Roles ( url = "%s/roles" % self . root , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
gets the roles class that allows admins to manage custom roles on portal
245,907
def resources ( self , start = 1 , num = 10 ) : url = self . _url + "/resources" params = { "f" : "json" , "start" : start , "num" : num } return self . _get ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
Resources lists all file resources for the organization . The start and num paging parameters are supported .
245,908
def addResource ( self , key , filePath , text ) : url = self . root + "/addresource" params = { "f" : "json" , "token" : self . _securityHandler . token , "key" : key , "text" : text } files = { } files [ 'file' ] = filePath res = self . _post ( url = url , param_dict = params , files = files , securityHandler = self ...
The add resource operation allows the administrator to add a file resource for example the organization s logo or custom banner . The resource can be used by any member of the organization . File resources use storage space from your quota and are scanned for viruses .
245,909
def updateSecurityPolicy ( self , minLength = 8 , minUpper = None , minLower = None , minLetter = None , minDigit = None , minOther = None , expirationInDays = None , historySize = None ) : params = { "f" : "json" , "minLength" : minLength , "minUpper" : minUpper , "minLower" : minLower , "minLetter" : minLetter , "min...
updates the Portals security policy
245,910
def portalAdmin ( self ) : from . . manageportal import PortalAdministration return PortalAdministration ( admin_url = "https://%s/portaladmin" % self . portalHostname , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initalize = False )
gets a reference to a portal administration class
245,911
def addUser ( self , invitationList , subject , html ) : url = self . _url + "/invite" params = { "f" : "json" } if isinstance ( invitationList , parameters . InvitationList ) : params [ 'invitationList' ] = invitationList . value ( ) params [ 'html' ] = html params [ 'subject' ] = subject return self . _post ( url = u...
adds a user without sending an invitation email
245,912
def inviteByEmail ( self , emails , subject , text , html , role = "org_user" , mustApprove = True , expiration = 1440 ) : url = self . root + "/inviteByEmail" params = { "f" : "json" , "emails" : emails , "subject" : subject , "text" : text , "html" : html , "role" : role , "mustApprove" : mustApprove , "expiration" :...
Invites a user or users to a site .
245,913
def usage ( self , startTime , endTime , vars = None , period = None , groupby = None , name = None , stype = None , etype = None , appId = None , deviceId = None , username = None , appOrgId = None , userOrgId = None , hostOrgId = None ) : url = self . root + "/usage" startTime = str ( int ( local_time_to_online ( dt ...
returns the usage statistics value
245,914
def servers ( self ) : self . __init ( ) items = [ ] for k , v in self . _json_dict . items ( ) : if k == "servers" : for s in v : if 'id' in s : url = "%s/%s" % ( self . root , s [ 'id' ] ) items . append ( self . Server ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_po...
gets all the server resources
245,915
def deleteRole ( self , roleID ) : url = self . _url + "/%s/delete" % roleID params = { "f" : "json" } return self . _post ( url = url , param_dict = params , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
deletes a role by ID
245,916
def updateRole ( self , roleID , name , description ) : params = { "name" : name , "description" : description , "f" : "json" } url = self . _url + "/%s/update" return self . _post ( url = url , param_dict = params , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
allows for the role name or description to be modified
245,917
def findRoleID ( self , name ) : for r in self : if r [ 'name' ] . lower ( ) == name . lower ( ) : return r [ 'id' ] del r return None
searches the roles by name and returns the role s ID
245,918
def get_config_value ( config_file , section , variable ) : try : parser = ConfigParser . SafeConfigParser ( ) parser . read ( config_file ) return parser . get ( section , variable ) except : return None
extracts a config file value
245,919
def users ( self ) : return Users ( url = "%s/users" % self . root , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
Provides access to all user resources
245,920
def getItem ( self , itemId ) : url = "%s/items/%s" % ( self . root , itemId ) return Item ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
gets the refernce to the Items class which manages content on a given AGOL or Portal site .
245,921
def FeatureContent ( self ) : return FeatureContent ( url = "%s/%s" % ( self . root , "features" ) , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
Feature Content class id the parent resource for feature operations such as Analyze and Generate .
245,922
def user ( self , username = None ) : if username is None : username = self . __getUsername ( ) url = "%s/%s" % ( self . root , username ) return User ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initalize = True )
gets the user s content . If None is passed the current user is used .
245,923
def saveThumbnail ( self , fileName , filePath ) : if self . _thumbnail is None : self . __init ( ) param_dict = { } if self . _thumbnail is not None : imgUrl = self . root + "/info/" + self . _thumbnail onlineFileName , file_ext = splitext ( self . _thumbnail ) fileNameSafe = "" . join ( x for x in fileName if x . isa...
URL to the thumbnail used for the item
245,924
def userItem ( self ) : if self . ownerFolder is not None : url = "%s/users/%s/%s/items/%s" % ( self . root . split ( '/items/' ) [ 0 ] , self . owner , self . ownerFolder , self . id ) else : url = "%s/users/%s/items/%s" % ( self . root . split ( '/items/' ) [ 0 ] , self . owner , self . id ) return UserItem ( url = u...
returns a reference to the UserItem class
245,925
def addRating ( self , rating = 5.0 ) : if rating > 5.0 : rating = 5.0 elif rating < 1.0 : rating = 1.0 url = "%s/addRating" % self . root params = { "f" : "json" , "rating" : "%s" % rating } return self . _post ( url , params , proxy_port = self . _proxy_port , securityHandler = self . _securityHandler , proxy_url = s...
Adds a rating to an item between 1 . 0 and 5 . 0
245,926
def addComment ( self , comment ) : url = "%s/addComment" % self . root params = { "f" : "json" , "comment" : comment } return self . _post ( url , params , proxy_port = self . _proxy_port , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url )
adds a comment to a given item . Must be authenticated
245,927
def itemComment ( self , commentId ) : url = "%s/comments/%s" % ( self . root , commentId ) params = { "f" : "json" } return self . _get ( url , params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url )
returns details of a single comment
245,928
def itemComments ( self ) : url = "%s/comments/" % self . root params = { "f" : "json" } return self . _get ( url , params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url )
returns all comments for a given item
245,929
def deleteComment ( self , commentId ) : url = "%s/comments/%s/delete" % ( self . root , commentId ) params = { "f" : "json" , } return self . _post ( url , params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url )
removes a comment from an Item
245,930
def packageInfo ( self ) : url = "%s/item.pkinfo" % self . root params = { 'f' : 'json' } result = self . _get ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , out_folder = tempfile . gettempdir ( ) ) return result
gets the item s package information file
245,931
def item ( self ) : url = self . _contentURL return Item ( url = self . _contentURL , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initalize = True )
returns the Item class of an Item
245,932
def reassignItem ( self , targetUsername , targetFoldername ) : params = { "f" : "json" , "targetUsername" : targetUsername , "targetFoldername" : targetFoldername } url = "%s/reassign" % self . root return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _...
The Reassign Item operation allows the administrator of an organization to reassign a member s item to another member of the organization .
245,933
def updateItem ( self , itemParameters , clearEmptyFields = False , data = None , metadata = None , text = None , serviceUrl = None , multipart = False ) : thumbnail = None largeThumbnail = None files = { } params = { "f" : "json" , } if clearEmptyFields : params [ "clearEmptyFields" ] = clearEmptyFields if serviceUrl ...
updates an item s properties using the ItemParameter class .
245,934
def status ( self , jobId = None , jobType = None ) : params = { "f" : "json" } if jobType is not None : params [ 'jobType' ] = jobType if jobId is not None : params [ "jobId" ] = jobId url = "%s/status" % self . root return self . _get ( url = url , param_dict = params , securityHandler = self . _securityHandler , pro...
Inquire about status when publishing an item adding an item in async mode or adding with a multipart upload . Partial is available for Add Item Multipart when only a part is uploaded and the item is not committed .
245,935
def commit ( self , wait = False , additionalParams = { } ) : url = "%s/commit" % self . root params = { "f" : "json" , } for key , value in additionalParams . items ( ) : params [ key ] = value if wait == True : res = self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_po...
Commit is called once all parts are uploaded during a multipart Add Item or Update Item operation . The parts are combined into a file and the original file is overwritten during an Update Item operation . This is an asynchronous call and returns immediately . Status can be used to check the status of the operation unt...
245,936
def folders ( self ) : if self . _folders is None : self . __init ( ) if self . _folders is not None and isinstance ( self . _folders , list ) : if len ( self . _folders ) == 0 : self . _loadFolders ( ) return self . _folders
gets the property value for folders
245,937
def items ( self ) : self . __init ( ) items = [ ] for item in self . _items : items . append ( UserItem ( url = "%s/items/%s" % ( self . location , item [ 'id' ] ) , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initalize = True ) ) return items
gets the property value for items
245,938
def addRelationship ( self , originItemId , destinationItemId , relationshipType ) : url = "%s/addRelationship" % self . root params = { "originItemId" : originItemId , "destinationItemId" : destinationItemId , "relationshipType" : relationshipType , "f" : "json" } return self . _post ( url = url , param_dict = params ...
Adds a relationship of a certain type between two items .
245,939
def createService ( self , createServiceParameter , description = None , tags = "Feature Service" , snippet = None ) : url = "%s/createService" % self . location val = createServiceParameter . value params = { "f" : "json" , "outputType" : "featureService" , "createParameters" : json . dumps ( val ) , "tags" : tags } i...
The Create Service operation allows users to create a hosted feature service . You can use the API to create an empty hosted feaure service from feature service metadata JSON .
245,940
def shareItems ( self , items , groups = "" , everyone = False , org = False ) : url = "%s/shareItems" % self . root params = { "f" : "json" , "items" : items , "everyone" : everyone , "org" : org , "groups" : groups } return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , p...
Shares a batch of items with the specified list of groups . Users can only share items with groups to which they belong . This operation also allows a user to share items with everyone in which case the items are publicly accessible or with everyone in their organization .
245,941
def createFolder ( self , name ) : url = "%s/createFolder" % self . root params = { "f" : "json" , "title" : name } self . _folders = None return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url )
Creates a folder in which items can be placed . Folders are only visible to a user and solely used for organizing content within that user s content space .
245,942
def analyze ( self , itemId = None , filePath = None , text = None , fileType = "csv" , analyzeParameters = None ) : files = [ ] url = self . _url + "/analyze" params = { "f" : "json" } fileType = "csv" params [ "fileType" ] = fileType if analyzeParameters is not None and isinstance ( analyzeParameters , AnalyzeParamet...
The Analyze call helps a client analyze a CSV file prior to publishing or generating features using the Publish or Generate operation respectively . Analyze returns information about the file including the fields present as well as sample records . Analyze attempts to detect the presence of location fields that may be ...
245,943
def __assembleURL ( self , url , groupId ) : from . . packages . six . moves . urllib_parse import urlparse parsed = urlparse ( url ) communityURL = "%s://%s%s/sharing/rest/community/groups/%s" % ( parsed . scheme , parsed . netloc , parsed . path . lower ( ) . split ( '/sharing/rest/' ) [ 0 ] , groupId ) return commun...
private function that assembles the URL for the community . Group class
245,944
def group ( self ) : split_count = self . _url . lower ( ) . find ( "/content/" ) len_count = len ( '/content/' ) gURL = self . _url [ : self . _url . lower ( ) . find ( "/content/" ) ] + "/community/" + self . _url [ split_count + len_count : ] return CommunityGroup ( url = gURL , securityHandler = self . _securityHan...
returns the community . Group class for the current group
245,945
def addUniqueValue ( self , value , label , description , symbol ) : if self . _uniqueValueInfos is None : self . _uniqueValueInfos = [ ] self . _uniqueValueInfos . append ( { "value" : value , "label" : label , "description" : description , "symbol" : symbol } )
adds a unique value to the renderer
245,946
def removeUniqueValue ( self , value ) : for v in self . _uniqueValueInfos : if v [ 'value' ] == value : self . _uniqueValueInfos . remove ( v ) return True del v return False
removes a unique value in unique Value Info
245,947
def addClassBreak ( self , classMinValue , classMaxValue , label , description , symbol ) : if self . _classBreakInfos is None : self . _classBreakInfos = [ ] self . _classBreakInfos . append ( { "classMinValue" : classMinValue , "classMaxValue" : classMaxValue , "label" : label , "description" : description , "symbol"...
adds a classification break value to the renderer
245,948
def removeClassBreak ( self , label ) : for v in self . _classBreakInfos : if v [ 'label' ] == label : self . _classBreakInfos . remove ( v ) return True del v return False
removes a classification break value to the renderer
245,949
def downloadThumbnail ( self , outPath ) : url = self . _url + "/info/thumbnail" params = { } return self . _get ( url = url , out_folder = outPath , file_name = None , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
downloads the items s thumbnail
245,950
def __init ( self ) : params = { "f" : "json" } json_dict = self . _get ( self . _url , params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url ) self . _json = json . dumps ( json_dict ) self . _json_dict = json_dict attributes = [ attr for attr in dir ( sel...
populates all the properties for the map service
245,951
def getExtensions ( self ) : extensions = [ ] if isinstance ( self . supportedExtensions , list ) : for ext in self . supportedExtensions : extensionURL = self . _url + "/exts/%s" % ext if ext == "SchematicsServer" : extensions . append ( SchematicsService ( url = extensionURL , securityHandler = self . _securityHandle...
returns objects for all map service extensions
245,952
def allLayers ( self ) : url = self . _url + "/layers" params = { "f" : "json" } res = self . _get ( url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) return_dict = { "layers" : [ ] , "tables" : [ ] } for k , v in res . items ( ) : ...
returns all layers for the service
245,953
def find ( self , searchText , layers , contains = True , searchFields = "" , sr = "" , layerDefs = "" , returnGeometry = True , maxAllowableOffset = "" , geometryPrecision = "" , dynamicLayers = "" , returnZ = False , returnM = False , gdbVersion = "" ) : url = self . _url + "/find" params = { "f" : "json" , "searchTe...
performs the map service find operation
245,954
def getFeatureDynamicLayer ( self , oid , dynamicLayer , returnZ = False , returnM = False ) : url = self . _url + "/dynamicLayer/%s" % oid params = { "f" : "json" , "returnZ" : returnZ , "returnM" : returnM , "layer" : { "id" : 101 , "source" : dynamicLayer . asDictionary } } return Feature ( json_string = self . _get...
The feature resource represents a single feature in a dynamic layer in a map service
245,955
def identify ( self , geometry , mapExtent , imageDisplay , tolerance , geometryType = "esriGeometryPoint" , sr = None , layerDefs = None , time = None , layerTimeOptions = None , layers = "top" , returnGeometry = True , maxAllowableOffset = None , geometryPrecision = None , dynamicLayers = None , returnZ = False , ret...
The identify operation is performed on a map service resource to discover features at a geographic location . The result of this operation is an identify results resource . Each identified result includes its name layer ID layer name geometry and geometry type and other attributes of that result as name - value pairs .
245,956
def fromJSON ( value ) : if isinstance ( value , str ) : value = json . loads ( value ) elif isinstance ( value , dict ) : pass else : raise AttributeError ( "Invalid input" ) return Extension ( typeName = value [ 'typeName' ] , capabilities = value [ 'capabilities' ] , enabled = value [ 'enabled' ] == "true" , maxUplo...
returns the object from json string or dictionary
245,957
def asList ( self ) : return [ self . _red , self . _green , self . _blue , self . _alpha ]
returns the value as the list object
245,958
def color ( self , value ) : if isinstance ( value , ( list , Color ) ) : if value is list : self . _color = value else : self . _color = value . asList
sets the color
245,959
def outlineColor ( self , value ) : if isinstance ( value , ( list , Color ) ) : if value is list : self . _outlineColor = value else : self . _outlineColor = value . asList
sets the outline color
245,960
def outline ( self , value ) : if isinstance ( value , SimpleLineSymbol ) : self . _outline = value . asDictionary
sets the outline
245,961
def base64ToImage ( imgData , out_path , out_file ) : fh = open ( os . path . join ( out_path , out_file ) , "wb" ) fh . write ( imgData . decode ( 'base64' ) ) fh . close ( ) del fh return os . path . join ( out_path , out_file )
converts a base64 string to a file
245,962
def find ( self , text , magicKey = None , sourceCountry = None , bbox = None , location = None , distance = 3218.69 , outSR = 102100 , category = None , outFields = "*" , maxLocations = 20 , forStorage = False ) : if isinstance ( self . _securityHandler , ( AGOLTokenSecurityHandler , OAuthSecurityHandler ) ) : url = s...
The find operation geocodes one location per request ; the input address is specified in a single parameter .
245,963
def geocodeAddresses ( self , addresses , outSR = 4326 , sourceCountry = None , category = None ) : params = { "f" : "json" } url = self . _url + "/geocodeAddresses" params [ 'outSR' ] = outSR params [ 'sourceCountry' ] = sourceCountry params [ 'category' ] = category params [ 'addresses' ] = addresses return self . _p...
The geocodeAddresses operation is performed on a Geocode Service resource . The result of this operation is a resource representing the list of geocoded addresses . This resource provides information about the addresses including the address location score and other geocode service - specific attributes . You can provi...
245,964
def __init ( self ) : params = { "f" : "json" , } json_dict = self . _get ( self . _url , params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) self . _json_dict = json_dict self . _json = json . dumps ( self . _json_dict ) attributes = [ attr for attr in...
initializes the properties
245,965
def __init ( self ) : params = { "f" : "json" } json_dict = self . _get ( url = self . _url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) attributes = [ attr for attr in dir ( self ) if not attr . startswith ( '__' ) and not attr . ...
initializes all the properties
245,966
def download ( self , itemID , savePath ) : if os . path . isdir ( savePath ) == False : os . makedirs ( savePath ) url = self . _url + "/%s/download" % itemID params = { } if len ( params . keys ( ) ) : url = url + "?%s" % urlencode ( params ) return self . _get ( url = url , param_dict = params , out_folder = savePat...
downloads an item to local disk
245,967
def reports ( self ) : if self . _metrics is None : self . __init ( ) self . _reports = [ ] for r in self . _metrics : url = self . _url + "/%s" % six . moves . urllib . parse . quote_plus ( r [ 'reportname' ] ) self . _reports . append ( UsageReport ( url = url , securityHandler = self . _securityHandler , proxy_url =...
returns a list of reports on the server
245,968
def editUsageReportSettings ( self , samplingInterval , enabled = True , maxHistory = 0 ) : params = { "f" : "json" , "maxHistory" : maxHistory , "enabled" : enabled , "samplingInterval" : samplingInterval } url = self . _url + "/settings/edit" return self . _post ( url = url , param_dict = params , securityHandler = s...
The usage reports settings are applied to the entire site . A POST request updates the usage reports settings .
245,969
def createUsageReport ( self , reportname , queries , metadata , since = "LAST_DAY" , fromValue = None , toValue = None , aggregationInterval = None ) : url = self . _url + "/add" params = { "f" : "json" , "usagereport" : { "reportname" : reportname , "since" : since , "metadata" : metadata } } if isinstance ( queries ...
Creates a new usage report . A usage report is created by submitting a JSON representation of the usage report to this operation .
245,970
def edit ( self ) : usagereport_dict = { "reportname" : self . reportname , "queries" : self . _queries , "since" : self . since , "metadata" : self . _metadata , "to" : self . _to , "from" : self . _from , "aggregationInterval" : self . _aggregationInterval } params = { "f" : "json" , "usagereport" : json . dumps ( us...
Edits the usage report . To edit a usage report you need to submit the complete JSON representation of the usage report which includes updates to the usage report properties . The name of the report cannot be changed when editing the usage report .
245,971
def __init ( self ) : params = { "f" : "json" , } json_dict = self . _get ( self . _url , params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) self . _json_dict = json_dict self . _json = json . dumps ( self . _json_dict ) attributes = [ attr for attr in...
inializes the properties
245,972
def replicasResource ( self ) : if self . _replicasResource is None : self . _replicasResource = { } for replica in self . replicas : self . _replicasResource [ "replicaName" ] = replica . name self . _replicasResource [ "replicaID" ] = replica . guid return self . _replicasResource
returns a list of replices
245,973
def services ( self ) : self . _services = [ ] params = { "f" : "json" } if not self . _url . endswith ( '/services' ) : uURL = self . _url + "/services" else : uURL = self . _url res = self . _get ( url = uURL , param_dict = params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_u...
returns all the service objects in the admin service s page
245,974
def refresh ( self , serviceDefinition = True ) : url = self . _url + "/MapServer/refresh" params = { "f" : "json" , "serviceDefinition" : serviceDefinition } res = self . _post ( url = self . _url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _p...
The refresh operation refreshes a service which clears the web server cache for the service .
245,975
def editTileService ( self , serviceDefinition = None , minScale = None , maxScale = None , sourceItemId = None , exportTilesAllowed = False , maxExportTileCount = 100000 ) : params = { "f" : "json" , } if not serviceDefinition is None : params [ "serviceDefinition" ] = serviceDefinition if not minScale is None : param...
This post operation updates a Tile Service s properties
245,976
def refresh ( self ) : params = { "f" : "json" } uURL = self . _url + "/refresh" res = self . _get ( url = uURL , param_dict = params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url ) self . __init ( ) return res
refreshes a service
245,977
def addToDefinition ( self , json_dict ) : params = { "f" : "json" , "addToDefinition" : json . dumps ( json_dict ) , "async" : False } uURL = self . _url + "/addToDefinition" res = self . _post ( url = uURL , param_dict = params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url ...
The addToDefinition operation supports adding a definition property to a hosted feature service . The result of this operation is a response indicating success or failure with error code and description .
245,978
def updateDefinition ( self , json_dict ) : definition = None if json_dict is not None : if isinstance ( json_dict , collections . OrderedDict ) == True : definition = json_dict else : definition = collections . OrderedDict ( ) if 'hasStaticData' in json_dict : definition [ 'hasStaticData' ] = json_dict [ 'hasStaticDat...
The updateDefinition operation supports updating a definition property in a hosted feature service . The result of this operation is a response indicating success or failure with error code and description .
245,979
def calc_resp ( password_hash , server_challenge ) : password_hash += b'\0' * ( 21 - len ( password_hash ) ) res = b'' dobj = des . DES ( password_hash [ 0 : 7 ] ) res = res + dobj . encrypt ( server_challenge [ 0 : 8 ] ) dobj = des . DES ( password_hash [ 7 : 14 ] ) res = res + dobj . encrypt ( server_challenge [ 0 : ...
calc_resp generates the LM response given a 16 - byte password hash and the challenge from the Type - 2 message .
245,980
def create_LM_hashed_password_v1 ( passwd ) : if re . match ( r'^[\w]{32}:[\w]{32}$' , passwd ) : return binascii . unhexlify ( passwd . split ( ':' ) [ 0 ] ) passwd = passwd . upper ( ) lm_pw = passwd + '\0' * ( 14 - len ( passwd ) ) lm_pw = passwd [ 0 : 14 ] magic_str = b"KGS!@#$%" res = b'' dobj = des . DES ( lm_pw ...
create LanManager hashed password
245,981
def _readcsv ( self , path_to_csv ) : return np . genfromtxt ( path_to_csv , dtype = None , delimiter = ',' , names = True )
reads a csv column
245,982
def queryDataCollectionByName ( self , countryName ) : var = self . _dataCollectionCodes try : return [ x [ 0 ] for x in var [ var [ 'Countries' ] == countryName ] ] except : return None
returns a list of available data collections for a given country name .
245,983
def __geometryToDict ( self , geom ) : if isinstance ( geom , dict ) : return geom elif isinstance ( geom , Point ) : pt = geom . asDictionary return { "geometry" : { "x" : pt [ 'x' ] , "y" : pt [ 'y' ] } } elif isinstance ( geom , Polygon ) : poly = geom . asDictionary return { "geometry" : { "rings" : poly [ 'rings' ...
converts a geometry object to a dictionary
245,984
def lookUpReportsByCountry ( self , countryName ) : code = self . findCountryTwoDigitCode ( countryName ) if code is None : raise Exception ( "Invalid country name." ) url = self . _base_url + self . _url_list_reports + "/%s" % code params = { "f" : "json" , } return self . _post ( url = url , param_dict = params , sec...
looks up a country by it s name Inputs countryName - name of the country to get reports list .
245,985
def createReport ( self , out_file_path , studyAreas , report = None , format = "PDF" , reportFields = None , studyAreasOptions = None , useData = None , inSR = 4326 , ) : url = self . _base_url + self . _url_create_report if isinstance ( studyAreas , list ) == False : studyAreas = [ studyAreas ] studyAreas = self . __...
The GeoEnrichment Create Report method uses the concept of a study area to define the location of the point or area that you want to enrich with generated reports . This method allows you to create many types of high - quality reports for a variety of use cases describing the input area . If a point is used as a study ...
245,986
def getVariables ( self , sourceCountry , optionalCountryDataset = None , searchText = None ) : r url = self . _base_url + self . _url_getVariables params = { "f" : "json" , "sourceCountry" : sourceCountry } if not searchText is None : params [ "searchText" ] = searchText if not optionalCountryDataset is None : params ...
r The GeoEnrichment GetVariables helper method allows you to search the data collections for variables that contain specific keywords .
245,987
def folders ( self ) : if self . _folders is None : self . __init ( ) if "/" not in self . _folders : self . _folders . append ( "/" ) return self . _folders
returns a list of all folders
245,988
def services ( self ) : self . _services = [ ] params = { "f" : "json" } json_dict = self . _get ( url = self . _currentURL , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) if "services" in json_dict . keys ( ) : for s in json_dict [ '...
returns the services in the current folder
245,989
def createService ( self , service ) : url = self . _url + "/createService" params = { "f" : "json" } if isinstance ( service , str ) : params [ 'service' ] = service elif isinstance ( service , dict ) : params [ 'service' ] = json . dumps ( service ) return self . _post ( url = url , param_dict = params , securityHand...
Creates a new GIS service in the folder . A service is created by submitting a JSON representation of the service to this operation .
245,990
def exists ( self , folderName , serviceName = None , serviceType = None ) : url = self . _url + "/exists" params = { "f" : "json" , "folderName" : folderName , "serviceName" : serviceName , "type" : serviceType } return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_...
This operation allows you to check whether a folder or a service exists . To test if a folder exists supply only a folderName . To test if a service exists in a root folder supply both serviceName and serviceType with folderName = None . To test if a service exists in a folder supply all three parameters .
245,991
def __init ( self ) : params = { "f" : "json" } json_dict = self . _get ( url = self . _currentURL , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) self . _json = json . dumps ( json_dict ) self . _json_dict = json_dict attributes = [ ...
populates server admin information
245,992
def serviceManifest ( self , fileType = "json" ) : url = self . _url + "/iteminfo/manifest/manifest.%s" % fileType params = { } f = self . _get ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , out_folder = tempfile . gettem...
The service manifest resource documents the data and other resources that define the service origins and power the service . This resource will tell you underlying databases and their location along with other supplementary files that make up the service .
245,993
def startDataStoreMachine ( self , dataStoreItemName , machineName ) : url = self . _url + "/items/enterpriseDatabases/%s/machines/%s/start" % ( dataStoreItemName , machineName ) params = { "f" : "json" } return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = sel...
Starts the database instance running on the Data Store machine .
245,994
def unregisterDataItem ( self , path ) : url = self . _url + "/unregisterItem" params = { "f" : "json" , "itempath" : path , "force" : "true" } return self . _post ( url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
Unregisters a data item that has been previously registered with the server s data store .
245,995
def validateDataStore ( self , dataStoreName , machineName ) : url = self . _url + "/items/enterpriseDatabases/%s/machines/%s/validate" % ( dataStoreName , machineName ) params = { "f" : "json" } return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _prox...
Checks the status of ArcGIS Data Store and provides a health check response .
245,996
def layers ( self ) : if self . _layers is None : self . __init ( ) lyrs = [ ] for lyr in self . _layers : lyr [ 'object' ] = GlobeServiceLayer ( url = self . _url + "/%s" % lyr [ 'id' ] , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url ) lyrs . append ( lyr )...
gets the globe service layers
245,997
def loadFeatures ( self , path_to_fc ) : from . . common . spatial import featureclass_to_json v = json . loads ( featureclass_to_json ( path_to_fc ) ) self . value = v
loads a feature class features to the object
245,998
def fromFeatureClass ( fc , paramName ) : from . . common . spatial import featureclass_to_json val = json . loads ( featureclass_to_json ( fc ) ) v = GPFeatureRecordSetLayer ( ) v . value = val v . paramName = paramName return v
returns a GPFeatureRecordSetLayer object from a feature class
245,999
def asDictionary ( self ) : template = { "type" : "simple" , "symbol" : self . _symbol . asDictionary , "label" : self . _label , "description" : self . _description , "rotationType" : self . _rotationType , "rotationExpression" : self . _rotationExpression } return template
provides a dictionary representation of the object