Return token data from handle_token
Notes for dev
This commit is contained in:
parent
89fc8706cb
commit
cd1f0a2ae3
5 changed files with 55 additions and 6 deletions
|
|
@ -26,9 +26,24 @@ potentially misleading.
|
|||
2. Make more wrappers
|
||||
3. Write more documentation
|
||||
4. Wrappers should also accept actual keys for when you know them
|
||||
5. Add utility to manage the token easily to encourage reuse over
|
||||
new tokens every time
|
||||
5. Use this:
|
||||
|
||||
```python
|
||||
try:
|
||||
# NOTE: Maybe define self.session = requests.Session() in an __init__ or similar and use it here instead of the 'with' block for better performance.
|
||||
# Session for connection pooling and performance improvement
|
||||
with requests.Session() as session:
|
||||
# Update session headers once instead of every request
|
||||
session.headers.update(headers)
|
||||
|
||||
# GET requests to fetch normal and removed posts
|
||||
res_n = session.get(url_normal, timeout=60)
|
||||
# res_r = session.get(url_removed, timeout=60)
|
||||
|
||||
# Checking if both requests are good before proceeding
|
||||
res_n.raise_for_status()
|
||||
# res_r.raise_for_status()
|
||||
```
|
||||
|
||||
|
||||
Trust
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue