How to “perfectly” override a dict?

You can write an object that behaves like a dict quite easily with ABCs (Abstract Base Classes) from the collections.abc module. It even tells you if you missed a method, so below is the minimal version that shuts the ABC up. from collections.abc import MutableMapping class TransformedDict(MutableMapping): “””A dictionary that applies an arbitrary key-altering function … Read more

When should I use GET or POST method? What’s the difference between them?

It’s not a matter of security. The HTTP protocol defines GET-type requests as being idempotent, while POSTs may have side effects. In plain English, that means that GET is used for viewing something, without changing it, while POST is used for changing something. For example, a search page should use GET, while a form that … Read more

Passing base64 encoded strings in URL

There are additional base64 specs. (See the table here for specifics ). But essentially you need 65 chars to encode: 26 lowercase + 26 uppercase + 10 digits = 62. You need two more [‘+’, “https://stackoverflow.com/”] and a padding char ‘=’. But none of them are url friendly, so just use different chars for them … Read more

Is either GET or POST more secure than the other?

The GET request is marginally less secure than the POST request. Neither offers true “security” by itself; using POST requests will not magically make your website secure against malicious attacks by a noticeable amount. However, using GET requests can make an otherwise secure application insecure. The mantra that you “must not use GET requests to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)