Universal OAuth 1.0 Provider in Python with Redis – Stage 2

Been doing some more work with this OAuth 1.0 Provider and as it turns out, my implementation so too lean. Having said that, it’s exactly what I aimed for in the beginning: A simple lean OAuth 1.0 Provider implementation without getting buried over the concept of OAuth itself.

This iteration still have more things to be introduced. As pointed by willhn at GeekTalk.in here, OAuth 1.0 allow the OAuth authorization data to be passed through HTTP Authorization Header and POST. RFC 5849 documentation states the standard here. At the current 0.3.0 version, Authorization data are picked up only from Authorization Header.

My immediate goal for this project is to create an OAuth reverse proxy, carrying all valid requests into some other language independent backend be it in Python, PHP, Node.js or any other languages. For that, Stage 2 has accomplished the reverse proxy nature.

Stage 3 will be adding POST support for Authorization headers and to implement a reverse proxy to a publicly available API somewhere. I have a few in mind and the Internet Chuck Norris Database will make a great candidate :D

Talk is cheap, so here is an example of an endpoint implementation.

Naive Bayes Classifier in Python v1.0.4

Just finished work on a Naive Bayes Classifier in Python. Was interested to benchmark Python performance with large data sets. Also had the chance to get to know more about Cython. Indeed as a C extension, it increased performance.

So this project all started from my own implementation in PHP here. As it turns out, PHP is more performant than Python as of version 1.0.4 of this library. But there are differences.

The Python module redis available at PyPi is not compiled as a C extension while the PHP counterpart is definitely a C extension. So the bottleneck here I suspect is with the Redis client. Expect some more enhancements to the Redis clients in future versions.

So long story short, why not give it a go at https://github.com/tistaharahap/python-bayes-redis. Would love for feedbacks on how to further optimize the codes. Still very fresh with Python at the moment.

Universal OAuth 1.0 Provider in Python with Redis – Stage 1

Just a few days ago, I had a pretty long geektalk with Dondy about OAuth. He wanted to talk about which OAuth version is best for his needs. Long story short, the answer was OAuth 1.0. He was the one who ‘introduced‘ me into Python and I instantly got an itch to have a try in building an OAuth 1.0 Provider in Python.

First of all, I have no plans at the moment to support 3 legged authentications. I want to just go out there and code, make it work and refactor later to support things that are not supported initially.

The purpose of this provider is so that anyone can extends everything easily while still maintaining compatibility with RFC5849. At the current v0.1.1 version, the only available URI is 'oauth/access_token'. This is to get XAuth working first. To provide authentication, modify or extend _verify_xauth_credentials and suit your needs.

The next step is to abstract and provide decorators to initialize the provider in Flask.

Why Redis? Because Redis is unmatched in performance with atomic CRUDs. It’s lightning fast, CPU friendly and it’s basically a key/value store.

I am still new to Python, would love for some best practice pointers with the project. Forks and Pull Requests are welcomed.

The source code is available here at https://github.com/tistaharahap/oauth1-provider-redis-py

A test using Urbanesia’s OAuthnesia for Python is imported below.

GeekTalk.in – A collection of readables for geeks

I love Hacker News. There’s a lot of reading materials there that’ll empower you to do or even not do things. However, it’s not localized to where I have my most interest: Indonesia. So there you have it, a clone.

First things first, GeekTalk.in is built with Telescope, a Hacker News clone coded for Node.js with Meteor. Meteor is great for real time web apps, it’s very principle is database everywhere meaning that any CRUD operations is available everywhere within the server and the client with the same codebase/API.

Since it’s still a beta product, there are still bumps and bruises but what can beat living on the edge right?

For the time being, all posts will need approvals to be published. Why? Content is king. If you don’t get it, you never will.

All things said, you should also visit GeekBall.in and let’s dribble some hoops together.

OAUTHnesia for Python

Having a really good time with Python and finding things to be a LOT merrier and enjoyable. That being said, I coded OAUTHnesia for Python; an OAUTH v1.0a client for Urbanesia’s API.

A tutorial here really describes how easy it is to submit your own packages to PyPi. I followed through and to install this package is as easy as:

(sudo) pip install oauthnesia

OAUTHnesia is built upon requests and requests-oauthlib.

Usage is really simple. To do a search about steaks, one can do below: