Categories
django django OAuth python Security

Using django-oauth-toolkit for Client credentials Oauth Flow

I’ve been wanting to secure my api – so unidentified and unathorized parties cannot view, update, create or delete data. This api is internal to the company and will only be used by other services – in other words no end users. Hence the delegation of authorization need not happen and the services will be […]

Categories
GNU/Linux python

Prerequisite Packages and Compiling Python 3 on CentOS

What are the prerequisite packages for a complete python3 compilation install? You will always get issues like Pip not being able to access pypi because the openssl module was not installed. Other things need the gcc compiler and such. Recently I got this warning: Could not import the lzma module. Your installed Python is incomplete. […]

Categories
API python

HTTPX: An open stream object is being garbage collected; call “stream.close()” explicitly.

When using HTTPX I get the following error printed sometimes: An open stream object is being garbage collected; call "stream.close()" explicitly. According to these two github issues: An open stream object is being garbage collected; call "stream.close()" explicitly An open stream object is being garbage collected; call "stream.close()" explicitly This is a Python 3.8.0 issue. […]

Categories
python

How to speed up http calls in python? With Examples

Blocking HTTP requests The most popular and easy to use blocking http client for python is requests. The requests docs are simple and straight forward…for humans. The biggest performance gain you can acquire (provided you are making requests to a single host) is using an http session. This creates a persistent connection, meaning that additional […]

Categories
API python

Building a rest API client or SDK as a python package

The best way to learn ways of building your API wrapper / SDK is to build it yourself from scratch is to look at ones that already exist. Here is a list of python api wrappers you can checkout and view. Most if not all of them are already python packages. Here is a good […]