Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)

        def login(project, retries=2):
    if retries < 0:
        raise SbdkError('Login failed')
    url = project.schema_server_url + '/auth'
    usr = raw_input("Username: ")
    if not usr:
        return login(project, retries-1)
    pwd = getpass.getpass()
    resp = push_json(url, {'username': usr, 'password': pwd}, None, no_raise_for=[401, 402])
    if resp.status_code in (401, 402):
        print('Sorry. Try again.')
        return login(project, retries-1)
    return usr, resp.json()['session_id']
        


src/s/b/sbgsdk-0.5.4/sbdk/commands/upload.py   sbgsdk(Download)
from subprocess import Popen, PIPE
 
from sbdk.auth import login
 
 
        sys.exit(1)
    file = os.path.abspath(file)
    usr, sid = login(project)
    user_home = '/home/%s' % usr
    dest = os.path.join(user_home, os.path.basename(file))

src/s/b/sbgsdk-0.5.4/sbdk/docker/container.py   sbgsdk(Download)
from docker.auth.auth import load_config
 
from sbdk.auth import login
from sbdk.error import SbdkError
 
    def load_credentials(self, renew=False):
        cfg = load_config().get(self.project.docker_registry_url, None)
        if renew or not cfg:
            self._user, self._token = login(self.project)
            store_credentials(self.project.docker_registry_url, self._user, self._token)