Comments (4)
The second time we post our credentials we got a 403 as a response.
Please be more verbose. What is the exact response?
Edited:
Oh now i see,
you say it only crashes if
token = Token() # the program also crashes, if you leave out this line of code
this is left out. Yes, instantiation initializes new state such as state.
A refetch feature is nonetheless optional, but feel free to suggest such feature in a pull request. There are very likely endpoints exposed to renew the session token.
from postcard_creator_wrapper.
In order to call fetch again without instantiating a new token, the initialization code in the constructor must be recalled.
from postcard_creator_wrapper.
Did you run the programme above?
For me, it crashes in both cases, with and without the initialization code being run again. Even if you create an entirely new object (see code below).
import time
from postcard_creator.postcard_creator import Token
token = Token()
token.fetch_token(username='...', password='...', method='swissid')
print(token.headers)
time.sleep(token.token_expires_in) # wait until token expires
token2 = Token() # new token object
token2.fetch_token(username='...', password='...', method='swissid')
print(token2.headers)
The error I got is the one bellow. Caused by the 403 error of the post request in line 271.
Traceback (most recent call last):
File "D:\Projekte\postCardCreator\postcard_creator\token.py", line 283, in _get_access_token_swissid
url = resp.json()['nextAction']['successUrl']
File "D:\Projekte\postCardCreator\venv\lib\site-packages\requests\models.py", line 891, in json
return complexjson.loads(
File "C:\Python38\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Python38\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python38\lib\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)
Please enlighten me if I am doing something completely wrong.
from postcard_creator_wrapper.
Thanks for more detail. Yes I did run a sample snippet but it turned out my code was using the legacy wrapper.
Ok, this is a legitimate bug. Will flag it as such. I am currently still busy with grad school exams but I can (hopefully) look into it next week. You can increase the logging verbosity such that request and responses are traced and investigate the problem in the meantime. Otherwise I will see if I find some time next week 👍
from postcard_creator_wrapper.
Related Issues (20)
- API to the free 1/24 version? HOT 1
- 400 Error HOT 2
- improve swiss ID authentication HOT 1
- Valid Credicals HOT 4
- Endpoint issues with SwissID login HOT 3
- Compatibility with python 3.6
- Endpoint Issue with swissid authentication HOT 4
- Make new release HOT 1
- Reference to pytest-runner in setup.py HOT 1
- Token authentication with 'legacy' method no longer works HOT 7
- Newlines HOT 3
- authentication not working HOT 2
- Autentication with multiple connectet Accounts HOT 1
- Is this wrapper still functional? HOT 3
- SwissID login is now failing because of anomaly detection HOT 10
- clean up: Remove deprecated legacy endpoints
- Swissid login failed HOT 5
- postcard_creator.postcard_creator.PostcardCreatorException: fail to fetch https://account.post.ch/idp/ HOT 1
- Unexpected `.postcard_creator_wrapper_sent` folder HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcard_creator_wrapper.