def _check_url_with_sg_api_httplib2(self, url, certs): """ Given a url and the certs file, it will do a simple request and return the result. """ http = Http(ca_certs=certs) return http.request(url)
def saveShotgunImageLocally( url ): """save shotgun image locally""" if type( url ) not in [str, unicode]: return None debug.debug( "loading: " + url ) http = Http() [response, content] = http.request( url, "GET" ) debug.debug( response ) [path, filename] = __getPathFromImageUrl( url ) savedAt = __getAbsShotgunImagePath( path, filename ) debug.debug( savedAt ) imagefile = open( savedAt, "w" ) imagefile.write( content ) imagefile.close() return savedAt
def saveShotgunImageLocally(url): """save shotgun image locally""" if type(url) not in [str, unicode]: return None debug.debug("loading: " + url) http = Http() [response, content] = http.request(url, "GET") debug.debug(response) [path, filename] = __getPathFromImageUrl(url) savedAt = __getAbsShotgunImagePath(path, filename) debug.debug(savedAt) oldumask = os.umask(0o002) imagefile = open(savedAt, "w") imagefile.write(content) imagefile.close() os.umask(oldumask) os.chmod(savedAt, 0o664) return savedAt