403 IAM permission 'dialogflow.intents.list' on 'projects/None/agent' denied - dialogflow-es

import os
from fastapi import Request
from dotenv import load_dotenv
project_id = os.getenv('project_id')
import google.cloud.dialogflow_v2 as dialogflow
intents_client = dialogflow.IntentsClient()
parent = dialogflow.AgentsClient.agent_path(project_id)
I am trying to get the "intent list" / "entity list" but dialogflow does not response instead this message was showed
"403 IAM permission 'dialogflow.intents.list' on 'projects/None/agent' denied"

The problem here is that you can not use the dialogflow api in the local host. You will need to make it live with ngrok and then this will work. It will give all sorts of error on the local host.

Related

python slack API missing scope error despite appropriate scope for the bot token

I am trying to create a Slack API + Python web hook. I have setup the app and the bot tokens with the proper scope needed to create DM's with users and post messages. I am trying a sample script that will open channel.
import sys
import logging
logging.basicConfig(level=logging.DEBUG)
from slack_sdk import WebClient
slack_token = "xoxb-<random_value>"
client = WebClient(token=slack_token)
api_response = client.conversations_open(channel="user1")
I get an error response from the API:
slack_sdk.errors.SlackApiError: The request to the Slack API failed. (url: https://www.slack.com/api/conversations.open)
The server responded with: {'ok': False, 'error': 'missing_scope', 'needed': 'channels:write,groups:write,mpim:write,im:write', 'provided': 'incoming-webhook'}
Can someone please help ? For some reason, it identifies only the incoming-webhook. First time doing this. Any help appreciated

What does the "Failed to download" error mean when importing an API into SwaggerHub?

I'm trying to import my OpenAPI JSON file, http://...../swagger/v2/swagger.json, into SwaggerHub but the import fails with this error:
The "Show Details" link shows:
Details:
Status: 403
I don't know where the error comes from because the URL is correct. What should I do to successfully import the API?

Youtube oauth2 authorization returns redirect_uri_mismatch

I am trying to access the Youtube API via python so that I can insert videos into a playlist. To do so I have to use oauth2 to authorize myself. I have looked up many guides and videos and followed their instructions step by step but I always get the same result, saying Error 400: redirect_uri_mismatch
The code that I am using is
from google_auth_oauthlib.flow import InstalledAppFlow
flow = InstalledAppFlow.from_client_secrets_file("client_secrets.json", scopes=['https://www.googleapis.com/auth/youtube.force-ssl'])
flow.run_local_server(port=8080, prompt='consent')
credentials = flow.credentials
print(credentials.to_json())
I have also tried
from google_auth_oauthlib.flow import InstalledAppFlow
flow = InstalledAppFlow.from_client_secrets_file("client_secrets.json", scopes=['https://www.googleapis.com/auth/youtube.force-ssl'])
flow.run_console()
credentials = flow.credentials
print(credentials.to_json())
I understand that this occurs when there is a mismatch between the redirect_uri on the request side and what is listed in the console. But I have triple checked that on https://console.developers.google.com/ I have the redirect URI to be http://localhost.com:8080 and have checked to make sure that my client_secrets.json file reflects the same. I have set my JavaScript origins to also be http://localhost.com:8080. I have set my oauth clientID to be a web application as I am running this in pycharm. However, whenever I run my code I get the same error saying The redirect URI in the request, http://localhost:8080/, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/${your_client_id}?project=${your_project_number}
I have looked at the other questions on stackOverflow and have tried the solutions that were suggested but none of them have worked. I have no idea why I cannot get authorization and desperately need help

Sharepoint and Python3.7

I'm trying to access an internal sharepoint and I haven't been able to figure out how to do it. I've seen some examples and came up with some code but I got a 401 error out of it. I obviously replace my USERNAME and PASSWORD with my actual credentials but I still got a 401. I'm attempts to access the SharePoint and grab lists of data (That span multiple pages). Right now I'm trying to just access the site and proceed from there.
import requests
from requests.auth import HTTPBasicAuth
from requests_ntlm import HttpNtlmAuth
response = requests.get("http://share-internal.division.com/teams/alpha/Components/Lists/Types/AllItems.aspx", auth=HttpNtlmAuth('DOMAIN\\USERNAME','PASSWORD'))
print (response.status_code)
I also tried a Basic request such as
import requests
from requests.auth import HTTPBasicAuth
response = requests.get("http://share-internal.Server.com/teams/Beta/Components/Lists/Workt/AllItems.aspx", auth=HTTPBasicAuth(USERNAME, PASSWORD))
print (response.status_code)
Just to be honest: I censored some of the URL as to maintain privacy

Get Access to Sharepoint site using sharepy

I am trying to connect to a sharepoint site, however I get the AttributeError: 'NoneType' object has no attribute 'text'.
my code is as follows
import sharepy
s = sharepy.connect("https://example.sharepoint.com/",\
username='username', password='password')
Any idea why I get this error? I am allowed in the site, but not on the https://example.sharepoint.com/ server url, and also not allowed through python. I have tried several other ways in, using urllib.request and also requests. There my issue lies with having the HTTPError: Forbidden. The code run there is:
from sharepoint import SharePointSite, basic_auth_opener
server_url = 'https://example.sharepoint.com/'
opener = basic_auth_opener(server_url, "username",
"password")
site = SharePointSite(server_url, opener)
for sp_lists in site.lists:
print(sp_lists.id)
Seems like I have an issue with permission on the server or could it be something different?
sharepy shows this error if SharePoint returns an error message during the authentication. It is an error in the library because it doesn't know how to handle all error codes.
In your case the site url is wrong - "https://example.sharepoint.com" instead of "https://example.sharepoint.com/".
it might possible that you are missing header or other, please follow below link for more ideas on HTTP Error 403: Forbidden
https://mediatemple.net/community/products/dv/204644980/why-am-i-seeing-a-403-forbidden-error-message

Resources