Error: not found - missing when clicking on DB (Couchdb) - python

I am trying to view a Couchdb database in the browser named event_db. However, when I navigate to the following url: http://localhost:5984/_utils/database.html?event_db I get the an Error: not found missing and my url automatically redirects to http://localhost:5984/_utils/database.html?event_db/_changes.
This problem seemed to occur after I added _changes to the url and created a script checking the database for change here: couchdb-python change notifications
Has anyone ever experienced this problem? If so, how would I fix it?
My apologies I am new to Couchdb.
Thank you for your help,
Brian

Turns out I needed to clear my cache in my browser. After I did this, I was able to successfully navigate to the event_db.

Related

Dynamic route returns favicon.ico instead of variable in Flask

Good afternoon,
I am currently developing a Flask application, and I am experiencing an error that had never happened to me before. I am currently setting up a dynamic route in Flask. This is the piece of code:
#app.route('/viewcar/<string:carId>')
def viewcar(carId):
print(carId)
car = Car.getCarById(carId)
return render_template("car.html", car=car)
However, when I pass any variable to the URL (let's say "http://127.0.0.1:5000/viewcar/4975facbbce511b65e14f44719340029-cf161184-91fc"), when I check the output in the console, it says that carId equals to favicon.ico instead of "4975facbbce511b65e14f44719340029-cf161184-91fc". Any ideas on what could this be? It has never happened to me before. Thanks in advance.
I just ran into this issue today too, however I noticed that when I launch my development flask server at http://127.0.0.1:5000/ in Chrome (version 104.0.5112.101), the console logs show that it grabbed favicon.ico for the variable I was grabbing from the URL, but when I used Safari (version 15.3) the URL variable was correctly parsed.
Now I'm starting to think it's a browser related?
I'm really new to flask myself and also came across this issue. For me it was that I had another route in my module that got executed prior to this route I intended and the variable name was being assigned there so it seems the next (default?) argument must have been used in my intended route. I'm sure I'm only describing this halfway correct but hopefully it helps somebody debug their issue a little quicker.

AADSTS90102 error when using django-microsoft-auth for SSO with Azure AD

I followed the steps in this tutorial to enable SSO with Azure Active Directory for the admin portion (to start) of my Django app:
https://django-microsoft-auth.readthedocs.io/en/latest/usage.html
Navigating to /admin yields this page, which is good:
Clicking Microsoft brings up this new window:
The important error seems to be:
AADSTS90102: 'redirect_uri' value must be a valid absolute URI.
In this window, I used the browser console and found that a GET request was being made like this:
https://login.microsoftonline.com/50ce...90ac7/oauth2/v2.0/authorize?response_type=code&client_id=f4...27&redirect_uri=https,https://example.org/microsoft/auth-callback/&s...
Note the redirect_uri=https,https://.... It seems like that leading "https," is superfluous and is causing the problem. Any ideas where that could be coming from?
In my Azure app, the redirect URI is set to https://example.org/microsoft/auth-callback/:
I'm using Python 3.9.6, Django 3.2, django-microsoft-auth 2.4.0, NGINX 1.18.0, uvicorn 0.14.0
I've searched for help on this and haven't found anything relevant to my situation. Thanks in advance!
Based on the SO Thread Reference.
Use http as the redirect URI instead of https to resolve the issue in most cases.
use
http://localhost:8080/microsoft/auth-callback/
Instead of
https://localhost:8080/microsoft/auth-callback/
If there is a option,
Use localhost:8080 into the table django_site
Reference SO Thread: django-microsoft-auth : The provided value for the input parameter 'redirect_uri' is not valid
As you think, the first https is superfluous, you just need to delete it.
https://login.microsoftonline.com/50ce...90ac7/oauth2/v2.0/authorize?response_type=code&client_id=f4...27&redirect_uri=https://example.org/microsoft/auth-callback/&s...
By the way, I think there is no problem with the redirect_uri you set in the Azure portal.
I guess it is a problem of the redirecting URL. The example URL is coming from django site table. So first of all you need to enable the site:
#in settings.py
SITE_ID = 1
Afterwards you can go to the admin interface and set the url of the site to the correct domain. From my experience I know that it won't work without that.

Python Django /w Microsoft Graphs - I keep getting value error "state missing from auth_code_flow"

Python Django /w Microsoft Graphs -
I'm following this Microsoft Tutorial for building Django apps with Microsoft Graph (using it on my existing Django webapp), and I am having an issue with authentication: https://learn.microsoft.com/en-us/graph/tutorials/python
I'm on the step 'Add Azure AD authentication' and, after implementing,
I hit the sign in button and enter credentials...and I keep getting value error "state missing from auth_code_flow".
The "callback" method is only making it to result=get_token_from_code(request) and then fails.
Here is the get_token_from_code method:
def get_token_from_code(request):
cache = load_cache(request)
auth_app = get_msal_app(cache)
# Get the flow saved in session
flow = request.session.pop('auth_flow', {})
result = auth_app.acquire_token_by_auth_code_flow(flow, request.GET)
save_cache(request, cache)
return result
What I'm trying to do is eventually access excel online from my webapp.
Any help is greatly appreciated!
I just had this issue and resolved it. It is one of these two things:
You are starting out at 127.0.0.1:8000 and then when you're redirected you're at localhost:8000, which is a different domain. The sessions aren't remembered from one domain to the other. The solution is to start out on localhost:8000 so that the session persists across login.
Your browser is using super-strict cookie settings. Microsoft Edge appears to default to this mode on localhost and 127.0.0.1. There is a lock or shield icon in or near your address bar that lets you relax the restrictions on your cookie settings.
Try one or both of these and you should succeed.
I'm a beginner coder, so i'm pretty sure im just circumventing around the error. But replacing the website URL with http://localhost:8000/# and re running it somehow got around the error. maybe that could be of some use.
If you are running on chrome, rather than running application on http://127.0.0.1:8000 run it on http://localhost:8000, because chrome isn't saving the cookies when the ip address is being used.

Exception 400081 while downloading a view using TableauServerClient

I am using TableauServerClient (0.8) in a Python (3.7.1) script to download a view as .csv from Tableau server (2019.1.3 (20191.19.0417.1429) 64-bit Windows) onto my local machine. My code works for most of the views but for some views, I am getting following error:
tableauserverclient.server.endpoint.exceptions.ServerResponseError:
400081: Bad Request
There was a problem querying the data for view 'xyz'
Has someone faced this issue in the past? Any thoughts?
I was facing a similar error & neither the documentation of Python API nor the REST API had any info about this issue. ( I couldn't even find the API response error code in either)
But after a long search, I stumbled upon a suggestion by the user 'gaoang2148' in this thread.
For me, the error was occurring because a few data sources in my workbook were missing connection credentials ( The credentials were missing after I published an update from Tableau Desktop). Once I embedded the credentials for each data source, the code was working fine again. i was able to pull & download data from tableau views via API.
When I have run into this, it’s been on newly published views. I believe it has to do with Tableau's behind the scenes managing of views and/or data in the repository. Sometimes it takes an hour or two for a new view that's been published to query properly from TSC. Manually navigating to the view in browser also might force the view to be processed, but that could've been coincidence when it's happened to me. It usually resolves itself within an hour.

Uber Rides/Python - How to configure Oauth w. Apache

I'm new to this so I apologize in advance. I am actually an AppleScript developer and would merely like to use Uber Rides.py into a script, and I have virtually no knowledge in Python. (Just looking for an 'easy' way to initiate a Uber ride within a more complex script using Homebridge and Siri).
I've built the py app but I don't know to get the Oauth code after using the authorization_code_grant.py script.
I will be the only user of this app (it's just for testing at home) so I'm not that worried about Auth but I understand it's a mandatory uber process. There's no frontend to the app (it's just the script running and responding to Siri requests via Homebridge) and no web page for the user to authenticate. The user will be myself so I just need a way to "get" the Oauth code that I then will use as part of the CLI/Python command within the Applescript.
I have two main issues:
Can someone give me a step by step on how to grab the code sent by Uber once the user has logged in and clicked on the authorized button? I seem to understand I should configure my Apache server to "receive" the code but I don't know how to? (If it helps I have set up an Horuku account but I'm not sure I need this considering Apache runs on my Mac, I just don't know how to configure it…)
When I try to use the authorization_code py (with the URI set to http://localhost:7000 but, to my knowledge, nothing runs on port 7000 at the moment, hence question 1) it generates the error below
Error:
>mediacenter$ python example/authorization_code_grant.py
Login and grant access by going to:
login.uber.com/oauth/authorize?scope=profile+request+history&state=MgnYJ18l7DxqbSYxkSfjrbGCL8BQAMg0&redirect_uri=https%3A%2F%2Foauthswift.herokuapp.com%2Fcallback%2Fsiriuber&response_type=code&client_id=3Wk7zJbSLVCFCQ69UZvQJCZ_aBfHJBDu
>Copy the URL you are redirected to and paste here:
oauth-callback/siriuber?state=MgnYJ18l7DxqbSYxkSfjrbGCL8BQAMg0&code=dK1ETADCaHcZCAbXnYKOSapetgexgj
Failed to request access token: UNAUTHORIZED.
[ErrorDetails: 401 UNAUTHORIZED invalid_client]
Traceback (most recent call last):
File "example/authorization_code_grant.py", line 150, in
hello_user(api_client)
File "example/authorization_code_grant.py", line 122, in hello_user
response = api_client.get_user_profile()
AttributeError: 'NoneType' object has no attribute 'get_user_profile'
I hope it kind of makes sense. I know I should spend some time getting to learn a "real" language but AS is (most of the time) perfect to bring different things together quickly and doing what I want!
Thanks in advance,
JC
Same person from GitHub. After digging around, I came up with this.
Basically there is probably a configuration issue in either your example/config.yaml or in your app dashboard. Make sure you configured both of those correctly. the example/config.yaml setup should be exactly like this with the three values replaced. Make sure your redirect URL is the same as the one in your dashboard under "Authorizations" redirect URLs.
Did you install from source? As in did you clone it from the GitHub repo? Or did you install it using pip?
Hope this helps.

Categories

Resources