Exception: Error retrieving a Domo API Access Token: "status":401,"Unauthorized","path":"/oauth/toke
Hello, I'm using Python SDK to create a new DataSet in Domo.
I use client id and secret, but getting the error above.
If I do cURL-I get the access-token, all works good .If I use access-token in the script- I get this:
ConnectionError: HTTPSConnectionPool(host='api_host', port=443): Max retries exceeded with url: /oauth/token?grant_type=client_credentials (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0711397ee0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
I'm wondering if I need to ask the access-token from an Admin
Answers
-
Looks like you're not passing in the domain with the URL correctly. Without seeing your code I can't tell you exactly but look at where you're specifying which instance / domain you're using to connect to.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
Hello, @GrantSmith . Thank you for your reply. Here is the code:
from pydomo import Domo
from pydomo.datasets import DataSetRequest, Schema, Column, ColumnType, Policy
from pydomo.datasets import PolicyFilter, FilterOperator, PolicyType, Sorting
client_id="xxxx"
secret= "xxxx"
domo = Domo('client-id','secret', api_host='api.domo.com')
domo.logger.info("\n**** Domo API - DataSet Examples ****\n")
datasets = domo.datasets
# Define a DataSet Schema
dsr = DataSetRequest()
dsr.name = 'Test'
dsr.description = 'First interaction'
dsr.schema = Schema([Column(ColumnType.STRING, 'BMaaS')])
# Create a DataSet with the given Schema
dataset = datasets.create(dsr)
domo.logger.info("Created DataSet " + dataset['id'])
# Get a DataSets's metadata
retrieved_dataset = datasets.get(dataset['id'])
domo.logger.info("Retrieved DataSet " + retrieved_dataset['id'])
# Import Data from a file
csv_file_path = './some.csv'
datasets.data_import_from_file(dataset['id'], csv_file_path)
domo.logger.info("Uploaded data from a file to DataSet {}".format(dataset['id']))
0 -
If I run it with my company api-host(rakuten-du.domo.com) , I'm getting this:
Traceback (most recent call last):
File "/home/gala/.local/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
0 -
I found the mistake. I wrapped variables in brackets😂
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 755 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive