Tag

python

Create a Basic API With Flask

Flask is a _microframework_ for Python that you can use to quickly create API's and websites. It's a great and easy to use platform, let's create a simple API, but first we will go through the basics.

Create an Object With Namedtuple

Namedtuples are a subclass of typename which allow us to create objects (or classes) with tuple-like attributes, it's easy to create a class with immutable attributes with this library. Creating an object To create a namedtuple we only need the name of the class first and then the attribute list.

Return a List of Files and Folders With Glob

There's a great library added in Python 3.5 that lets you return a list of filenames and folders called glob, here's how to use it. Return files and folders in current folder. >>> glob('**') ['scaffolds', 'node_modules', 'yarn.lock', '_config.yml', 'source', 'db.json',

Unit Testing With Python

Learn the basics of Unit Testing in Python and its importance

Suppress Print Output in Python

Learn how to suppress print statements in Python

Classes and Special Methods in Python

These are my study notes on Classes and special methods. As always, if something is wrong then you can always correct me, it would help me and everybody else. Class 'Employee' example This is the example class that we're going to use, a class Employee which we will inherit from

Figure Out a Download File-Size With Requests

To get the filesize of a download is really easy, servers usually provide a Content-Length in its header response that let us know how heavy is the content we are requesting. We can find out this content length opening our shell and requesting a HEAD response in linux: [ As you

Scraping Web Data With Requests and BeautifulSoup [Part 2]

A quick recap of the last post: First we requested content using requests library and parsed the response's contents using BeautifulSoup library. We learned that we can manipulate HTML tags, get its contents and attributes (like href from an a tag). We found that the Class post-list is holding an
You've successfully subscribed to coding(dose)
Great! Next, complete checkout to get full access to all premium content.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.