Giter VIP home page Giter VIP logo

python_connection's Introduction

Python Connections for Data Science

This project contains a sample ipython notebook with code to connect to the Looker API (through HTTP endpoints) for common data extraction functions. This sample code allows you to

  1. Get Data from a Look
  2. Get Data from a Query
  3. Get Data from a Query Slug

Looker also provides you with the option to leverage a Python SDK via Swagger for full API Access. You can leverage generate the SDK here: https://discourse.looker.com/t/generating-client-sdks-for-the-looker-api/3185

python_connection's People

Contributors

haarthi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python_connection's Issues

.login() not returning json and throwing errors

Set API Credentials for Your Look Instance

creds = {
'api_endpoint' : 'https://my_org.looker.com:19999/api/3.0',
'login_url': 'https://my_org.looker.com:19999/login',
'client_id' : 'secret',
'client_secret': 'secret'
}

demo = LookerAPI(creds)

Login to Instance - Return token to be used in subsequent calls.

json_auth = demo.login()

print('access_token: ' + json_auth)

`https://my_org.looker.com:19999/login


JSONDecodeError Traceback (most recent call last)
/var/folders/ft/s3sdj8k95pl163zp1471x_g40000gn/T/ipykernel_24838/1138058121.py in
12
13 # Login to Instance - Return token to be used in subsequent calls.
---> 14 json_auth = demo.login()
15
16 print('test2')

/var/folders/ft/s3sdj8k95pl163zp1471x_g40000gn/T/ipykernel_24838/3181836974.py in login(self)
13 auth_data = {'client_id':self.client_id, 'client_secret':self.client_secret}
14 r = requests.post( self.login_endpoint,data=auth_data) # error handle here
---> 15 json_auth = json.loads(r.text)['access_token']
16 return json_auth
17 except requests.exceptions.RequestException as e:

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/init.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
348 cls = JSONDecoder

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py in decode(self, s, _w)
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.