Skip to content

Commit

Permalink
Merge pull request #178 from andamian/auth
Browse files Browse the repository at this point in the history
Moved auth out of extensions subpackage
  • Loading branch information
cbanek committed Sep 20, 2019
2 parents 87068c9 + 7e8646d commit cc8d4aa
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 17 deletions.
5 changes: 2 additions & 3 deletions examples/auth/cadc_auth_example.py
Expand Up @@ -6,9 +6,8 @@
import getpass

import requests

import pyvo
import pyvo.extensions.auth.authsession
from pyvo.auth import authsession

# Gather login information
data = {
Expand All @@ -28,7 +27,7 @@
cookie = '\"' + response.text + '\"'

# Configure the session and run the query
auth = pyvo.extensions.auth.authsession.AuthSession()
auth = authsession.AuthSession()
auth.credentials.set_cookie('CADC_SSO', cookie)
service = pyvo.dal.TAPService('https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap', auth)
job = service.search('SELECT * from TAP_SCHEMA.tables')
Expand Down
4 changes: 2 additions & 2 deletions examples/auth/cert_auth_example.py
Expand Up @@ -5,10 +5,10 @@
Tests for pyvo.extensions.authsession
"""
import pyvo
import pyvo.extensions.auth.authsession
from pyvo.auth import authsession

certificate_path = input('Path to client certificate file:')
auth = pyvo.extensions.auth.authsession.AuthSession()
auth = authsession.AuthSession()
auth.credentials.set_client_certificate(certificate_path)
service = pyvo.dal.TAPService('https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/tap', auth)
job = service.search('SELECT * from TAP_SCHEMA.tables')
Expand Down
8 changes: 3 additions & 5 deletions examples/auth/gaia_auth_example.py
Expand Up @@ -4,12 +4,10 @@
Example for authenticating with Gaia TAP service
"""
import getpass

import requests

import pyvo
import pyvo.extensions.auth.authsession
from pyvo.extensions.auth.securitymethods import ANONYMOUS
from pyvo.auth import securitymethods, authsession

# Gather login information
data = {
Expand All @@ -30,8 +28,8 @@
response.raise_for_status()

# Use this session with the auth cookie for all requests to Gaia.
auth = pyvo.extensions.auth.authsession.AuthSession()
auth.credentials.set(ANONYMOUS, session)
auth = authsession.AuthSession()
auth.credentials.set(securitymethods.ANONYMOUS, session)
service = pyvo.dal.TAPService('http://gea.esac.esa.int/tap-server/tap', auth)
job = service.search('SELECT * from TAP_SCHEMA.tables')
print(job)
2 changes: 1 addition & 1 deletion pyvo/__init__.py
Expand Up @@ -36,7 +36,7 @@
if not _ASTROPY_SETUP_:
from . import registry
from .dal import ssa, sia, sla, scs, tap

from . import auth
from .registry import search as regsearch
from .dal import (
imagesearch, spectrumsearch, conesearch, linesearch, tablesearch,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pyvo/extensions/auth/authurls.py → pyvo/auth/authurls.py
@@ -1,7 +1,7 @@
import collections
import logging

import pyvo.extensions.auth.securitymethods as securitymethods
from . import securitymethods


class AuthURLs():
Expand Down
Expand Up @@ -2,7 +2,7 @@

from pyvo.utils.http import create_session

import pyvo.extensions.auth.securitymethods as securitymethods
from . import securitymethods


class CredentialStore(object):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -4,4 +4,4 @@

def get_package_data():
paths = [os.path.join('data/tap', '*.xml')]
return {'pyvo.extensions.auth.tests': paths}
return {'pyvo.auth.tests': paths}
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for pyvo.extensions.auth
Tests for pyvo.auth
"""
import base64
from requests.cookies import RequestsCookieJar
Expand All @@ -12,7 +12,7 @@
from astropy.utils.data import get_pkg_data_contents

import pyvo.dal
from pyvo.extensions.auth.authsession import AuthSession
from pyvo.auth.authsession import AuthSession

from pyvo.dal.tests.test_tap import MockAsyncTAPServer

Expand Down
1 change: 0 additions & 1 deletion pyvo/extensions/auth/tests/__init__.py

This file was deleted.

0 comments on commit cc8d4aa

Please sign in to comment.