I’ve started working on a QR-code based inventory management and pricing system. One of the foundational elements of this system is the ability to print a price tag with a QR code on it, and to be able to update the link associated with that QR code without replacing the sticker.
This is possible if the QR code links to bit.ly instead of directly to the link in question. So long as the shortened URL is generated under a Bitly account, it can be edited and modified after the fact.
The Bitly API is at the same time well documented, and a bit frustrating. It’s frustrating because all of the example Python code on the internet uses the bitly_api package, which is apparently either abandoned or complete trash. For example, all of the examples on the internet result in an error like this:
bitly api.bitly _api.Bitly Error: "PERMANENTLY REMOVED"
I assume this means that the method has been removed from the class or package, but I couldn’t find a way to fix it.
Instead, let’s use the https requests library to connect to the Bitly API and generate a shortened link.
First things first, you should go check