Skip to content

Instantly share code, notes, and snippets.


Sharoon Thomas sharoonthomas

View GitHub Profile
sharoonthomas /
Created Oct 9, 2019
Example of using fulfil authentication in a flask app
@blueprint.route('/login', methods=['GET', 'POST'])
def login():
If there is no login, redirect the user to the authorization url
oauth_session = get_oauth_session()
next = flask.request.args.get('next')
authorization_url, state = oauth_session.create_authorization_url(
sharoonthomas / FULFIL_CLA
Last active Mar 20, 2019
Contributor License Agreement (CLA)
# Fulfil.IO Open Source Projects Individual Contributor License Agreement
Thank you for your interest in contributing to Fulfil.IO Open Source Projects ("We" or "Us").
This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us by electronic submission, following the instructions at . This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.
## 1. Definitions
"You" means the individual who Submits a Contribution to Us.
sharoonthomas /
Created Dec 28, 2018
Benchmark postgres servers
touch /etc/apt/sources.list.d/pgdg.list
echo "deb xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - | sudo apt-key add -
apt-get update
apt-get install -y postgresql-10
# now go to pgtune for config
sharoonthomas /
Created Nov 20, 2018
Utilize Fulfil API to download complete Activity Stream Data history
import requests
import pandas as pd
from import json_normalize
import numpy as np
import os
import json
from import storage, bigquery
import datetime
import time
from multiprocessing.pool import ThreadPool
sharoonthomas /
Created Aug 29, 2018
Reading Fulfil interactive reports from API
from datetime import date
from fulfil_client import Client
fulfil = Client('<subdomain>', '<apikey>')
# Fetch the report instance
# The name can be obtained from the URL
report = fulfil.interactive_report('account.invoice.revenue_by_month.ireport')
# Trigger execution with the fields
sharoonthomas /
Last active Sep 26, 2018
Update the supplier prices over API by reading a CSV file with sku, supplier_name and price
import os
import csv
import sys
from decimal import Decimal
from fulfil_client import Client
client = Client(
sharoonthomas /
Created Mar 2, 2018
Find weight from scale using python and usb
# -*- coding: utf-8 -*-
Utilities to fetch weight from weighing scales
:copyright: (c) 2016-2018 by Fulfil.IO Inc.
:license: see LICENSE for details.
from collections import namedtuple
sharoonthomas /
Created Jan 5, 2018
Update supplier inventory from third party shopify store

Supplier Inventory Feed


  • Your supplier uses shopify.
  • They are willing to expose inventory over Shopify API giving you a private app API key and Password.
  • You are using fulfil and has product suppliers defined.

How this works

sharoonthomas / PO-CSV.jinja
Created Jan 1, 2018
Jinja2 template for rendering PO lines as a CSV file on
View PO-CSV.jinja
"Po number","Ship to Name","Ship to address","Ship to phone number","Product name","Our SKU","Your SKU","Quantity","Amount"
{% for record in records -%}
{% for line in record.lines %}"{{ [
line.purchase.customer and,
line.purchase.customer and line.purchase.delivery_address.full_address.replace('\r\n', ','),
line.purchase.customer and,
line.supplier_product_name or line.description,
line.product and line.product.code,
line.supplier_product_code or '',
sharoonthomas /
Created Nov 27, 2017
This example shows how to fetch data for from Fulfil. The code is written to be compatible with any kitchensinks.
import unicodecsv as csv
from kitchensink.extensions import fulfil
Product = fulfil.model('product.product')
SaleLine = fulfil.model('sale.line')
PurchaseLine = fulfil.model('purchase.line')
def format_product(product):