Skip to content

Python starter code doesn't work #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kartikey-git opened this issue Aug 15, 2023 · 9 comments
Open

Python starter code doesn't work #38

kartikey-git opened this issue Aug 15, 2023 · 9 comments

Comments

@kartikey-git
Copy link

I followed the Xero "Up and Running with xero-python-oauth2-starter project" tutorial on youtube.

I have tried to implement it multiple times and it just doesn't work.

There are multiple comments on youtube and GitHub in the last few months from other people too. I have followed it carefully step by step and haven't missed any detail.

Here's a detailed explanation of what's not working :-

After completing all steps when I first went to localhost:5000 after running the app this is the error I got -

Untitled (1)

After some searching, I found out that this is due to flask-session error. So I ran these commands -

pip uninstall Flask Flask-Session
pip install Flask Flask-Session

Then I again followed the tutorial and got this error instead-
Untitled (2)

Here is the screenshot of the VS code terminal window -
Untitled (3)

Addtional Details -
I am running this on Mac (M2).
Editor - VS code.

I made sure that the URI is correct, Client secret and client ID is correct. I followed the tutorial multiple times perfectly. Please tell me what I need to do to get this working.

@github-actions
Copy link

PETOSS-335

@github-actions
Copy link

Thanks for raising an issue, a ticket has been created to track your request

@fred-py
Copy link

fred-py commented Sep 14, 2023

@kartikey-git Have you been able to fix this issue? I am having the same problem.

@gvedana
Copy link

gvedana commented Oct 24, 2023

kartikey-git, fred-py do you still get the same error?
I solved it just by running app.run() instead of app.run(host='localhost', port=5000) in the app.py file

@fred-py
Copy link

fred-py commented Nov 19, 2023

@gvedana My issue was completely unrelated, I was trying to connect with a xero account I had not been granted the correct permission. It would be nice if the error message was more clear as I spent quite some time trying different things and all I needed was to be granted permission from the given account.

@kartikey-git
Copy link
Author

kartikey-git commented Dec 6, 2023

pip install Flask Flask-Session

@fred-py Can you tell me how did you check that you required just a permission ? And how did you resolve it ? I still haven't resolved this issue and maybe that's what I need to do. I am trying with the demo company and assumed that I must already be having all permissions. Is it not the case ?

@fred-py
Copy link

fred-py commented Dec 19, 2023

@kartikey-git From memory I was trying to connect with my work account which I didn't have the permission needed to proceed, I then connected with a demo account from a Xero account I am the owner of. My guess is, if you are trying to connect with a demo account from someone else's Xero account, they may need to grant you additional access?

@wirelessfrank
Copy link

I followed the Xero "Up and Running with xero-python-oauth2-starter project" tutorial on youtube.

did the:

pip uninstall Flask Flask-Session
pip install Flask Flask-Session

Now it works up to the login
Got the login page and entered the login/password.

Instead of the access token I get the error page

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

raise w
Warning: Scope has changed from "projects accounting.attachments accounting.contacts accounting.reports.read accounting.transactions offline_access assets profile accounting.journals.read accounting.settings email openid" to "payroll.timesheets offline_access accounting.transactions.read openid projects accounting.attachments files accounting.transactions assets payroll.payslip profile accounting.settings accounting.attachments.read payroll.settings payroll.payruns accounting.settings.read email accounting.contacts accounting.contacts.read accounting.reports.read accounting.journals.read payroll.employees".
127.0.0.1 - - [13/Apr/2024 10:52:37] "GET /callback?code=58GSWmJdZGxDn_sv6jPzsbAvWknYYMaRdlEBinNBsp0&scope=openid%20profile%20email%20accounting.transactions%20accounting.reports.read%20accounting.journals.read%20accounting.settings%20accounting.contacts%20accounting.attachments%20assets%20projects%20offline_access&state=YaqQYhOP2hDuWxyU7Gmq1NM7PJYSAH&session_state=9ev1MJG4Rj2Rru_Yy6nD-drAGcyGbn1gaCd7kZGpE2E.nfV0bMwAdSLMn7VWm1kzQQ HTTP/1.1" 500 -

Any idea what I'm missing?

@thehigherbounce
Copy link

pip install --upgrade flask-session flask-oauthlib
or else, pls upgrade your requirements.txt

blinker==1.8.1
cachelib==0.13.0
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
Flask==3.0.3
Flask-OAuthlib==0.9.6
Flask-Session==0.8.0
idna==3.7
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
msgspec==0.18.6
oauthlib==2.1.0
python-dateutil==2.9.0.post0
requests==2.31.0
requests-oauthlib==1.1.0
six==1.16.0
urllib3==2.2.1
Werkzeug==3.0.3
xero_python==1.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants