Did I find the right examples for you? yes no

All Samples(18)  |  Call(10)  |  Derive(0)  |  Import(8)
Expand authentification token

>>> xauth(None)
>>> xauth(('user', 'pass'))
('user', 'pass')
>>> xauth('user:pass')
('user', 'pass')
>>> xauth('apikey')
('apikey', '')

        def xauth(auth):
    """Expand authentification token

    >>> xauth(None)
    >>> xauth(('user', 'pass'))
    ('user', 'pass')
    >>> xauth('user:pass')
    ('user', 'pass')
    >>> xauth('apikey')
    ('apikey', '')

    """
    if auth is None or isinstance(auth, tuple):
        return auth
    else:
        u, _, p = auth.partition(':')
        return u, p
        


src/h/u/hubstorage-0.13.1/hubstorage/resourcetype.py   hubstorage(Download)
import logging, time, json, socket
from collections import MutableMapping
import requests.exceptions as rexc
from .utils import urlpathjoin, xauth
from .serialization import jlencode, jldecode
    def __init__(self, client, key, auth=None):
        self.client = client
        self.key = urlpathjoin(self.resource_type, key, self.key_suffix)
        self.auth = xauth(auth) or client.auth
        self.url = urlpathjoin(client.endpoint, self.key)

src/p/y/python-hubstorage-HEAD/hubstorage/resourcetype.py   python-hubstorage(Download)
import logging, time, json, socket
from collections import MutableMapping
import requests.exceptions as rexc
from .utils import urlpathjoin, xauth
from .serialization import jlencode, jldecode
    def __init__(self, client, key, auth=None):
        self.client = client
        self.key = urlpathjoin(self.resource_type, key, self.key_suffix)
        self.auth = xauth(auth) or client.auth
        self.url = urlpathjoin(client.endpoint, self.key)

src/h/u/hubstorage-0.13.1/hubstorage/project.py   hubstorage(Download)
from .frontier import Frontier
from .resourcetype import ResourceType, MappingResourceType
from .utils import urlpathjoin, xauth
 
 
        assert len(self.projectid.split('/')) == 1, \
                'projectkey must be just one id: %s' % projectid
        self.auth = xauth(auth) or client.auth
        self.jobs = Jobs(client, self.projectid, auth=auth)
        self.items = Items(client, self.projectid, auth=auth)

src/h/u/hubstorage-0.13.1/hubstorage/client.py   hubstorage(Download)
import pkgutil
from requests import session
from .utils import xauth, urlpathjoin
from .project import Project
from .job import Job
    def __init__(self, auth=None, endpoint=None, connection_timeout=None):
        self.auth = xauth(auth)
        self.endpoint = endpoint or self.DEFAULT_ENDPOINT
        self.connection_timeout = connection_timeout or self.DEFAULT_TIMEOUT
        self.session = self._create_session()
    def jobsummaries(self, auth=None, **params):
        auth = xauth(auth) or self.auth
        return next(self.apiget('jobsummaries', params=params, auth=auth))
 

src/p/y/python-hubstorage-HEAD/hubstorage/project.py   python-hubstorage(Download)
from .frontier import Frontier
from .resourcetype import ResourceType, MappingResourceType
from .utils import urlpathjoin, xauth
 
 
        assert len(self.projectid.split('/')) == 1, \
                'projectkey must be just one id: %s' % projectid
        self.auth = xauth(auth) or client.auth
        self.jobs = Jobs(client, self.projectid, auth=auth)
        self.items = Items(client, self.projectid, auth=auth)

src/p/y/python-hubstorage-HEAD/hubstorage/client.py   python-hubstorage(Download)
import pkgutil
from requests import session, adapters
from .utils import xauth, urlpathjoin
from .project import Project
from .job import Job
    def __init__(self, auth=None, endpoint=None, connection_timeout=None,
            max_retries=0):
        self.auth = xauth(auth)
        self.endpoint = endpoint or self.DEFAULT_ENDPOINT
        self.connection_timeout = connection_timeout or self.DEFAULT_TIMEOUT
    def jobsummaries(self, auth=None, **params):
        auth = xauth(auth) or self.auth
        return next(self.apiget('jobsummaries', params=params, auth=auth))
 

src/h/u/hubstorage-0.13.1/hubstorage/batchuploader.py   hubstorage(Download)
from Queue import Queue
from threading import Thread, Event
from .utils import xauth, iterqueue
from .serialization import jsonencode
 
    def create_writer(self, url, start=0, auth=None, size=1000, interval=15,
                      qsize=None, content_encoding='identity',
                      maxitemsize=1024 ** 2, callback=None):
        assert not self.closed, 'Can not create new writers when closed'
        auth = xauth(auth) or self.client.auth

src/p/y/python-hubstorage-HEAD/hubstorage/batchuploader.py   python-hubstorage(Download)
from Queue import Queue
from threading import Thread, Event
from .utils import xauth, iterqueue
from .serialization import jsonencode
 
    def create_writer(self, url, start=0, auth=None, size=1000, interval=15,
                      qsize=None, content_encoding='identity',
                      maxitemsize=1024 ** 2, callback=None):
        assert not self.closed, 'Can not create new writers when closed'
        auth = xauth(auth) or self.client.auth