Adventures in C

If you’re more familiar with Python you’ll need to tackle pointers…

Let’s look at an example :

The first thing you may notice is that there is no need for a “return” from the function….

Example 1 – Pointers


void tripler(int *p);

int main(){
    int num = 5;
    int *ptr;
    ptr = &num;


void tripler(int *p){
    *p = *p * 3;

pointer and address of operator

Example 2 – Pointer that updates conditionally, based on values read from an array

Example 3 – How to convert seconds into h:m:s

Convert seconds into h:m:s with C

Example 4 – Hundreds, tens, units from a 3 digit integer.

Use the modulus operator and division by 10

2d Arrays in C

Numpy is easier? Same concept though…
ebay api requests

Python API – POST Requests

Many API endpoints require use of the POST method.

Here we look at how you can use Python and Requests to work with an API. Example code and a real world example connecting to the EBAY API.

Endpoint – The URL that delineates what data you are interacting with.

Method – Specifies how you’re interacting with the resource located at the provided endpoint. REST APIs can provide methods to enable full Create, Read, Update, and Delete (CRUD) functionality. Here are common methods most REST APIs provide:

GET – Retrieve data

PUT – Replace data

POST – Create data

DELETE – Delete data

Data – If you’re using a method that involves changing data in a REST API, you’ll need to include a data payload with the request that includes all data that will be created or modified.

Headers contain any metadata that needs to be included with the request, such as authentication tokens, the content type that should be returned, and any caching policies.

Authenticate to a REST API

The most common framework for API authentication is OAuth. acts as an equivalent to a username/password combination;

Once you have an access token, you can provide it as a bearer token in the request header: this is the most secure way to authenticate to a REST API with an access token:

my_headers = {‘Authorization’ : ‘Bearer {access_token}’} response = requests.get(‘’, headers=my_headers)

API Response

response.content() # Return the raw bytes of the data payload response.text() # Return a string representation of the data payload response.json() # This method is convenient when the API returns JSON

– examples –