Load a system from the remote location specified by *url*.

    **Example**

    ::

        load_remote_system('https://raw.github.com/chemlab/chemlab-testdata/master/naclwater.gro')
295
def load_remote_system(url, format=None):
    '''
    '''
    filename, headers = urlretrieve(url)
    return load_system(filename, format=format)
25389
def run(self, conn, tmp, module_name, module_args, inject):
        '''  '''

        # load up options
        options = utils.parse_kv(module_args)
        source = options.get('src', None)
        dest = options.get('dest', None)
        if source is None or dest is None:
            results = dict(failed=True, msg="src and dest are required")
            return ReturnData(conn=conn, result=results)

        # files are saved in dest dir, with a subdir for each host, then the filename
        dest   = "%s/%s/%s" % (utils.path_dwim(self.runner.basedir, dest), conn.host, source)
        dest   = dest.replace("//","/")

        # calculate md5 sum for the remote file
        remote_md5 = self.runner._remote_md5(conn, tmp, source)

        # use slurp if sudo and permissions are lacking
        remote_data = None
        if remote_md5 in ('1', '2') and self.runner.sudo:
            slurpres = self.runner._execute_module(conn, tmp, 'slurp', 'src=%s' % source, inject=inject)
            if slurpres.is_successful():
                if slurpres.result['encoding'] == 'base64':
                    remote_data = base64.b64decode(slurpres.result['content'])
                if remote_data is not None:
                    remote_md5 = utils.md5s(remote_data)

        # these don't fail because you may want to transfer a log file that possibly MAY exist
        # but keep going to fetch other log files
        if remote_md5 == '0':
            result = dict(msg="unable to calculate the md5 sum of the remote file", file=source, changed=False)
            return ReturnData(conn=conn, result=result)
        if remote_md5 == '1':
            result = dict(msg="the remote file does not exist, not transferring, ignored", file=source, changed=False)
            return ReturnData(conn=conn, result=result)
        if remote_md5 == '2':
            result = dict(msg="no read permission on remote file, not transferring, ignored", file=source, changed=False)
            return ReturnData(conn=conn, result=result)

        # calculate md5 sum for the local file
        local_md5 = utils.md5(dest)

        if remote_md5 != local_md5:
            # create the containing directories, if needed
            if not os.path.isdir(os.path.dirname(dest)):
                os.makedirs(os.path.dirname(dest))

            # fetch the file and check for changes
            if remote_data is None:
                conn.fetch_file(source, dest)
            else:
                f = open(dest, 'w')
                f.write(remote_data)
                f.close()
            new_md5 = utils.md5(dest)
            if new_md5 != remote_md5:
                result = dict(failed=True, md5sum=new_md5, msg="md5 mismatch", file=source, dest=dest)
                return ReturnData(conn=conn, result=result)
            result = dict(changed=True, md5sum=new_md5, dest=dest)
            return ReturnData(conn=conn, result=result)
        else:
            result = dict(changed=False, md5sum=local_md5, file=source, dest=dest)
            return ReturnData(conn=conn, result=result)
99056
def from_url(cls, url, version=None, require_https=False):
        
        if "https://" in url:
            require_https = True
        if "http://" in url and require_https:
            try:
                hive = cls.from_url(url, version=version, require_https=False)
            except HiveLoadedOverHTTP as err:
                hive = err.hive
            raise HiveLoadedOverHTTP(url, hive)
        else:
            try:
                return cls(**download_as_json(url)).from_version(version, require_https)
            except (ResponseException, URLError):
                raise MissingHive(url)
919687
def load_remotes(extra_path=None, load_user=True):
    

    from os.path import getmtime

    try:
        remotes_file = find_config_file(REMOTES_FILE, extra_path=extra_path, load_user=load_user)
    except ConfigurationError:
        remotes_file = None


    if remotes_file is not None and os.path.exists(remotes_file):
        config = AttrDict()
        config.update_yaml(remotes_file)

        if not 'remotes' in config:
            config.remotes = AttrDict()

        config.remotes.loaded = [remotes_file, getmtime(remotes_file)]

        return config
    else:
        return None
1111677
def loadu(self, url, **kwargs):
        
        return self.load(self.open(url, **kwargs), **kwargs)
268353
def get_remote_url(self, remote='origin', cached=True):
        """"""
        if hasattr(self.__class__, '_remote_url') and cached:
            url = self.__class__._remote_url
        else:
            r = self.get_remote(remote)
            try:
                url = list(r.urls)[0]
            except GitCommandError as ex:
                if 'correct access rights' in str(ex):
                    # If ssh is not setup to access this repository
                    cmd = ['git', 'config', '--get', 'remote.%s.url' % r.name]
                    url = Git().execute(cmd)
                else:
                    raise ex
            except AttributeError:
                url = None
            if url is not None and url.startswith('git@'):
                domain = url.split('@')[1].split(':')[0]
                path = url.split(':')[1]
                url = "http://%s/%s" % (domain, path)
        self.__class__._remote_url = url
        return url
1328105
def load(self, url, offset=0, length=-1):
        

        # if starting with . or /, can only be a file path..
        file_only = url.startswith(('/', '.'))

        # convert to filename
        filename = from_file_url(url)
        if filename != url:
            file_only = True
            url = filename

        try:
            # first, try as file
            afile = open(url, 'rb')

        except IOError:
            if file_only:
                raise

            return super(LocalFileLoader, self).load(url, offset, length)

        if offset > 0:
            afile.seek(offset)

        if length >= 0:
            return LimitReader(afile, length)
        else:
            return afile
771181
def execute_from_url(self, url, input_url):
        '''
        

        '''
        inputs = self._request(input_url)
        resp = self.execute(url, inputs)
        return resp
1254460
def get_url(self):
        '''
        
        '''
        if self.role in ('git_pillar', 'winrepo'):
            # With winrepo and git_pillar, the remote is specified in the
            # format '<branch> <url>', so that we can get a unique identifier
            # to hash for each remote.
            try:
                self.branch, self.url = self.id.split(None, 1)
            except ValueError:
                self.branch = self.conf['branch']
                self.url = self.id
        else:
            self.url = self.id
429639
def resolve_remote(uri, handlers):
    
    scheme = urlparse.urlsplit(uri).scheme
    if scheme in handlers:
        result = handlers[scheme](uri)
    else:
        req = urlopen(uri)
        encoding = req.info().get_content_charset() or 'utf-8'
        result = json.loads(req.read().decode(encoding),)
    return result
383518
def _load_resource(self):
        """"""

        url = self._url
        if self._params:
            url += '?{0}'.format(six.moves.urllib_parse.urlencode(self._params))

        r = getattr(self._session, self._meta.get_method.lower())(url)

        if r.status_code == 404:
            raise NotFoundException('Server returned 404 Not Found for the URL {0}'.format(self._url))
        elif not 200 <= r.status_code < 400:
            raise HTTPException('Server returned {0} ({1})'.format(r.status_code, r.reason), r)

        data = self._meta.deserializer.to_dict(r.text)
        self.populate_field_values(data)
1220392
def get_url(self, environ):
        """"""
        if self.override_url:
            url = self.override_url
        else:
            # PEP333: wsgi.url_scheme, HTTP_HOST, SERVER_NAME, and SERVER_PORT
            # can be used to reconstruct a request's complete URL

            # Much of the following is copied from bottle.py
            http = (environ.get('HTTP_X_FORWARDED_PROTO') or
                    environ.get('wsgi.url_scheme', 'http'))
            host = (environ.get('HTTP_X_FORWARDED_HOST') or
                    environ.get('HTTP_HOST'))
            if not host:
                # HTTP 1.1 requires a Host-header. This is for HTTP/1.0
                # clients.
                host = environ.get('SERVER_NAME', '127.0.0.1')
                port = environ.get('SERVER_PORT')
                if port and port != ('80' if http == 'http' else '443'):
                    host += ':' + port
            url = "%s://%s" % (http, host)
        return url
209472
def load_yaml_from_url(ont_url):
    """"""
    res = requests.get(ont_url)
    if res.status_code != 200:
        raise Exception('Could not load ontology from %s' % ont_url)
    root = yaml.load(res.content)
    return root
519535
def _fetch_remote_file(service_url, params=None, use_http_post=False):
    
    if not params:
        params = {}

    request_url, response = _fetch_remote(service_url, params, use_http_post)
    dummy, params = cgi.parse_header(
            response.headers.get('Content-Disposition', ''))
    fn = params['filename']

    return (response.headers.get('content-type'),
            fn, response.read(), response.geturl())
1141632
public boolean loadRemote() {
        for (URI itemToLoad : remoteResources) {
            try {
                return load(itemToLoad, false);
            } catch (Exception e) {
                LOG.log(Level.INFO, "Failed to load resource: " + itemToLoad, e);
            }
        }
        return false;
    }
1151382
def call_remote(method, args)

      urn, soap_url = block_given? ? yield : ["urn:partner.soap.sforce.com", @url.path]

      # Create XML text from the arguments.
      expanded = ''
      @builder = Builder::XmlMarkup.new(:target => expanded)
      expand(@builder, {method => args}, urn)

      extra_headers = ""
      extra_headers << (AssignmentRuleHeaderUsingRuleId % assignment_rule_id) if assignment_rule_id
      extra_headers << AssignmentRuleHeaderUsingDefaultRule if use_default_rule
      extra_headers << MruHeader if update_mru
      extra_headers << (ClientIdHeader % client_id) if client_id

      if trigger_user_email or trigger_other_email or trigger_auto_response_email
        extra_headers << '<partner:EmailHeader soap:mustUnderstand="1">'

        extra_headers << '<partner:triggerUserEmail>true</partner:triggerUserEmail>' if trigger_user_email
        extra_headers << '<partner:triggerOtherEmail>true</partner:triggerOtherEmail>' if trigger_other_email
        extra_headers << '<partner:triggerAutoResponseEmail>true</partner:triggerAutoResponseEmail>' if trigger_auto_response_email

        extra_headers << '</partner:EmailHeader>'
      end

      # Fill in the blanks of the SOAP envelope with our
      # session ID and the expanded XML of our request.
      request = (Envelope % [@session_id, @batch_size, extra_headers, expanded])

      # reset the batch size for the next request
      @batch_size = DEFAULT_BATCH_SIZE

      # gzip request
      request = encode(request)

      headers = {
        'Connection' => 'Keep-Alive',
        'Content-Type' => 'text/xml',
        'SOAPAction' => '""',
        'User-Agent' => 'activesalesforce rforce/1.0'
      }

      unless show_debug
        headers['Accept-Encoding'] = 'gzip'
        headers['Content-Encoding'] = 'gzip'
      end

      # Send the request to the server and read the response.
      response = @server.post2(soap_url, request.lstrip, headers)

      # decode if we have encoding
      content = decode(response)

      # Check to see if INVALID_SESSION_ID was raised and try to relogin in
      if method != :login and @session_id and content =~ /sf:INVALID_SESSION_ID/
        login(@user, @password)

        # repackage and rencode request with the new session id
        request = (Envelope % [@session_id, @batch_size, extra_headers, expanded])
        request = encode(request)

        # Send the request to the server and read the response.
        response = @server.post2(soap_url, request.lstrip, headers)

        content = decode(response)
      end

      SoapResponse.new(content).parse
    end
505686
async def load_remote(
            self, email: str, password: str,
            skip_existing: bool = True) -> None:
        """"""
        auth_resp = await self._request(
            'post',
            'https://my.rainmachine.com/login/auth',
            json={'user': {
                'email': email,
                'pwd': password,
                'remember': 1
            }})

        access_token = auth_resp['access_token']

        sprinklers_resp = await self._request(
            'post',
            'https://my.rainmachine.com/devices/get-sprinklers',
            access_token=access_token,
            json={'user': {
                'email': email,
                'pwd': password,
                'remember': 1
            }})

        for sprinkler in sprinklers_resp['sprinklers']:
            if skip_existing and sprinkler['mac'] in self.controllers:
                continue

            controller = RemoteController(self._request, self._websession)
            await controller.login(
                access_token, sprinkler['sprinklerId'], password)

            version_data = await controller.api.versions()
            controller.api_version = version_data['apiVer']
            controller.hardware_version = version_data['hwVer']
            controller.mac = sprinkler['mac']
            controller.name = sprinkler['name']
            controller.software_version = version_data['swVer']

            self.controllers[sprinkler['mac']] = controller