Skip to content

Instantly share code, notes, and snippets.

Sharoon Thomas sharoonthomas

Block or report user

Report or block sharoonthomas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sharoonthomas
sharoonthomas / auth.py
Created Oct 9, 2019
Example of using fulfil authentication in a flask app
View auth.py
@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(
redirect_uri=flask.url_for(
'.authorized',
@sharoonthomas
sharoonthomas / FULFIL_CLA
Last active Mar 20, 2019
Contributor License Agreement (CLA)
View FULFIL_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
sharoonthomas / postgres-benchmark.sh
Created Dec 28, 2018
Benchmark postgres servers
View postgres-benchmark.sh
touch /etc/apt/sources.list.d/pgdg.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
apt-get install -y postgresql-10
# now go to pgtune for config
@sharoonthomas
sharoonthomas / pull_fulfil_activity_stream.py
Created Nov 20, 2018
Utilize Fulfil API to download complete Activity Stream Data history
View pull_fulfil_activity_stream.py
import requests
import pandas as pd
from pandas.io.json import json_normalize
import numpy as np
import os
import json
from google.cloud import storage, bigquery
import datetime
import time
from multiprocessing.pool import ThreadPool
@sharoonthomas
sharoonthomas / read_report.py
Created Aug 29, 2018
Reading Fulfil interactive reports from API
View read_report.py
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
sharoonthomas / update_supplier_prices.py
Last active Sep 26, 2018
Update the supplier prices over API by reading a CSV file with sku, supplier_name and price
View update_supplier_prices.py
import os
import csv
import sys
from decimal import Decimal
from fulfil_client import Client
client = Client(
os.environ.get('FULFIL_SUBDOMAIN'),
os.environ.get('FULFIL_API_KEY'),
@sharoonthomas
sharoonthomas / get_weight.py
Created Mar 2, 2018
Find weight from scale using python and usb
View get_weight.py
# -*- coding: utf-8 -*-
"""
scale.py
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
sharoonthomas / README.md
Created Jan 5, 2018
Update supplier inventory from third party shopify store
View README.md

Supplier Inventory Feed

Usage

  • 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
sharoonthomas / PO-CSV.jinja
Created Jan 1, 2018
Jinja2 template for rendering PO lines as a CSV file on fulfil.io
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.number,
line.purchase.customer and line.purchase.customer.name,
line.purchase.customer and line.purchase.delivery_address.full_address.replace('\r\n', ','),
line.purchase.customer and line.purchase.customer.phone,
line.supplier_product_name or line.description,
line.product and line.product.code,
line.supplier_product_code or '',
@sharoonthomas
sharoonthomas / fulfil-inventory-planner.py
Created Nov 27, 2017
This example shows how to fetch data for inventory-planner.com from Fulfil. The code is written to be compatible with any kitchensinks.
View fulfil-inventory-planner.py
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):
You can’t perform that action at this time.