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
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 659 Datasets
- 116 SQL DataFlows
- 2.2K Magic ETL
- 816 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 82 App Studio
- 45 Variables
- 776 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 82 Workflows
- 23 Code Engine
- 41 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 411 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 11 Software Integrations
- 144 Manage
- 140 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive