ArcGIS Server JavaScript API中ESRI字体下载


----------------------------------------------------------------------------------


import sys, os
import httplib, urllib, urllib2
import urlparse
import json
import traceback
import time
#
baseUrl = 'https://static.arcgis.com/fonts/arial-unicode-ms-regular/'
basePath = 'D:/fonts/arial-unicode-ms-regular/'
# https://static.arcgis.com/fonts/arial-unicode-ms-regular/256-510.pbf

def downRegular():
    try:
      for i in range(0, 256):
        fileName = str(i * 256) + '-' + str((i+1)*256 - 1) + '.pbf'
        url = baseUrl + fileName
        req = urllib2.Request(url)
        response = urllib2.urlopen(req)
        if response.getcode() == 200:
            data = response.read()
            response.close()
            with open(basePath + fileName, "wb") as code:
              code.write(data)
        print(fileName)
        time.sleep(1)
    except Exception,e:
        print("error info: {0}".format(traceback.format_exc()))


def main():
    downRegular()

if __name__ == '__main__':
    main()


----------------------------------------------------------------------------------

posted @ 2019-08-29 14:47  ParamousGIS  阅读(1669)  评论(2编辑  收藏  举报