Search

25 June, 2018

How to test POST call using Python?


I got into a situation recently where I needed to test if my POST function was indeed working. 
    Its easy to test GET method . You just visit the URL and that's it . But for POST, you an use Plugins. But unfortunately I can't do that , because my browser (admin restrictions ) doesn't allow me to install plugins . Fortunately if you have Python , you can easily do that .


How to work on a Python Project when modules versions needed are different? Use virtualenv



Gone are the days when you need to create a VM for working on a different set of tools.  People work on different projects which might need a special version of a module. (Or python itself) . The problem aggravates when  multiple users work on a single shared machine (Test environments or Build machines ) .Virtual Environments help solve problem . And its easy to use and share among fellow teammates.

12 June, 2018

Exploring Numpy

What can we really do with Numpy? Why should we use it at all ?

Start with : import numpy

1. We can create arrays .


method: numpy.array(object, dtype=None, copy=True, order='K', subok=False, ndmin=0)


>>> a = numpy.array(range(10))
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> a.dtype
dtype('int32')

In the above array, there are 10 columns and 1 row.

Note : The concept of rows and columns applies when you have a 2D array. However, the array numpy.array([1,2,3,4]) is a 1D array and so has only one dimension, therefore shape rightly returns a single valued iterable.

Refer this link


01 June, 2018

Python List sorting with key argument explored




Everybody uses lists as an array to store values. List provide a lot of in-build features.

  • Sorting
  • Membership
  • Indexing
  • Iteration
  • reversing
  • Adding/Removing
  • Popping
  • Count

Lots of reasons to use lists. I think, one of the most used features is sorting. Internally , python uses Merge sort technique to sort the array items. But the sort method can be used in many other ways to have more control.