Пример #1
0
    def CreateContectionFile(self):
        """
        wrkspc: store the ags file
        loginDict: dictionary stored login information

        """
        # con = 'http://localhost:6080/arcgis/admin'
        try:
            server_url = "http://{}:6080/arcgis/admin".format(
                self.__loginDict['server'])
            connection_file_path = str(self.__filePath)  #
            use_arcgis_desktop_staging_folder = False
            if os.path.exists(connection_file_path):
                os.remove(connection_file_path)
            out_name = os.path.basename(connection_file_path)

            path = os.path.split(self.filePath)[0]

            result = mapping.CreateGISServerConnectionFile(
                "ADMINISTER_GIS_SERVICES", path, out_name, server_url,
                "ARCGIS_SERVER", use_arcgis_desktop_staging_folder, path,
                self.__loginDict['userName'], self.__loginDict['passWord'],
                "SAVE_USERNAME")

            print "++++++++INFO:链接文件创建成功++++++++"

            return connection_file_path

        except Exception, msg:
            print msg
Пример #2
0
	def CreateContectionFile(self):
		try:
			server_url = "http://{}:{}/arcgis/admin".format(self.__loginDict['server'],self.__loginDict['port'])
			connection_file_path = str(self.__filePath)			#
			use_arcgis_desktop_staging_folder = False

			if os.path.exists(connection_file_path):
				os.remove(connection_file_path)
			out_name = os.path.basename(connection_file_path)

			path = os.path.split(self.filePath)[0]
			result = mapping.CreateGISServerConnectionFile("ADMINISTER_GIS_SERVICES",
														   path,
														  out_name,
														   server_url,
														   "ARCGIS_SERVER",
														   use_arcgis_desktop_staging_folder,
														   path,
														   self.__loginDict['userName'],
														   self.__loginDict['passWord'],
														   "SAVE_USERNAME"
														   )
			arcpy.AddMessage( "++++++++INFO: server connection file created++++++++")
			return connection_file_path

		except Exception, msg:
			arcpy.AddMessage( msg)