Never rebuild auth for archive.org URLs.
770961
def rebuild_auth(self, prepared_request, response):
        
        u = urlparse(prepared_request.url)
        if u.netloc.endswith('archive.org'):
            return
        super(ArchiveSession, self).rebuild_auth(prepared_request, response)
1201631
def clean():
    """"""
    os.chdir(os.path.join(project_root, 'docs'))
    sh("make clean")
    os.chdir(project_root)
    sh("rm -rf pyoauth2.egg-info")
1235001
def build_absolute_uri(request, location, protocol=None):
    
    from .account import app_settings as account_settings

    if request is None:
        site = Site.objects.get_current()
        bits = urlsplit(location)
        if not (bits.scheme and bits.netloc):
            uri = '{proto}://{domain}{url}'.format(
                proto=account_settings.DEFAULT_HTTP_PROTOCOL,
                domain=site.domain,
                url=location)
        else:
            uri = location
    else:
        uri = request.build_absolute_uri(location)
    # NOTE: We only force a protocol if we are instructed to do so
    # (via the `protocol` parameter, or, if the default is set to
    # HTTPS. The latter keeps compatibility with the debatable use
    # case of running your site under both HTTP and HTTPS, where one
    # would want to make sure HTTPS links end up in password reset
    # mails even while they were initiated on an HTTP password reset
    # form.
    if not protocol and account_settings.DEFAULT_HTTP_PROTOCOL == 'https':
        protocol = account_settings.DEFAULT_HTTP_PROTOCOL
    # (end NOTE)
    if protocol:
        uri = protocol + ':' + uri.partition(':')[2]
    return uri
942453
function errorBadCredentials(res) {
  var err = new Error('Invalid credentials');
  err.res = res;
  err.remote = 'github-content-api';
  throw err;
}
1049784
def oauth_only(function):
    """"""

    def check_for_oauth(self, *args, **kwargs):
        """
        Returns False if GitHubTools instance is not authenticated, or return
        the decorated fucntion if it is.
        """
        if not self.is_authenticated:
            self.oops("To use putgist you have to set your GETGIST_TOKEN")
            self.oops("(see `putgist --help` for details)")
            return False
        return function(self, *args, **kwargs)

    return check_for_oauth
56546
def archive_url(self, entity_id, channel=None):
        '''
        '''
        url = '{}/{}/archive'.format(self.url, _get_path(entity_id))
        return _add_channel(url, channel)
1215486
def create_archive(
            self,
            archive_name,
            authority_name,
            archive_path,
            versioned,
            raise_on_err=True,
            metadata=None,
            user_config=None,
            tags=None,
            helper=False):
        '''
        

        '''

        archive_metadata = self._create_archive_metadata(
            archive_name=archive_name,
            authority_name=authority_name,
            archive_path=archive_path,
            versioned=versioned,
            raise_on_err=raise_on_err,
            metadata=metadata,
            user_config=user_config,
            tags=tags,
            helper=helper)

        if raise_on_err:
            self._create_archive(
                archive_name,
                archive_metadata)
        else:
            self._create_if_not_exists(
                archive_name,
                archive_metadata)

        return self.get_archive(archive_name)
336936
def unauthenticated_url(obj = nil)
      obj = obj.url_for(:read).to_s.split("?")[0] if !obj.nil?
      obj
    end
1273224
def unroll_auth_headers(self, authheaders, exclude_signature=False, sep=",", quote=True):
        
        res = ""
        ordered = collections.OrderedDict(sorted(authheaders.items()))
        form = '{0}=\"{1}\"' if quote else '{0}={1}'
        if exclude_signature:
            return sep.join([form.format(k, urlquote(str(v), safe='')) for k, v in ordered.items() if k != 'signature'])
        else:
            return sep.join([form.format(k, urlquote(str(v), safe='') if k != 'signature' else str(v)) for k, v in ordered.items()])
846491
def no_auth(self):
        """"""
        old_basic_auth, self.auth = self.auth, None
        old_token_auth = self.headers.pop('Authorization', None)

        yield

        self.auth = old_basic_auth
        if old_token_auth:
            self.headers['Authorization'] = old_token_auth
96834
def OpenUrlWithBasicAuth(url, user='root', pwd=''):
   
   return requests.get(url, auth=HTTPBasicAuth(user, pwd), verify=False)
105194
def authenticate(org):
    
    with ProgressBar(_("Authenticating")) as progress_bar:
        user = _authenticate_ssh(org)
        progress_bar.stop()
        if user is None:
            # SSH auth failed, fallback to HTTPS
            with _authenticate_https(org) as user:
                yield user
        else:
            yield user
936518
async def remember(request, user_id):
    
    auth_policy = request.get(POLICY_KEY)
    if auth_policy is None:
        raise RuntimeError('auth_middleware not installed')

    return await auth_policy.remember(request, user_id)
273978
def delete_archives(self, *archives):
        '''
        
        '''
        # Remove paths
        _archives = []
        for archive in archives:
            _archives.append(os.path.basename(archive))
        archives = _archives[:]

        ret = {'files': {}, 'errors': {}}
        for archive in self.archives():
            arc_dir = os.path.dirname(archive)
            archive = os.path.basename(archive)
            if archives and archive in archives or not archives:
                archive = os.path.join(arc_dir, archive)
                try:
                    os.unlink(archive)
                    ret['files'][archive] = 'removed'
                except Exception as err:
                    ret['errors'][archive] = str(err)
                    ret['files'][archive] = 'left'

        return ret
227863
def delete_simple_httpauth_read_api(
        request,
        database_name,
        collection_name,
        slug):
    """"""
    ss = get_object_or_404(HTTPAuthReadAPI, database_name=database_name,
                           collection_name=collection_name, slug=slug)
    ss.delete()
    messages.success(request, _("Simple HTTP Auth Read API deleted."))
    return HttpResponseRedirect(
        reverse('djmongo_show_apis',
                args=(ss.database_name, ss.collection_name)))
148030
function setHost(uri) {
  if (uri.auth || uri.hostname || uri.port) {
    uri.host = '';
    if (uri.auth) uri.host += uri.auth + '@';
    if (uri.hostname) uri.host += uri.hostname;
    if (uri.port) uri.host += ':' + uri.port;
  }
}
985228
def set_archive_layout_url(self, archive_id):
        
        url = self.api_url + '/v2/project/' + self.api_key + '/archive/' + archive_id + '/layout'
        return url