Skip to content

Instantly share code, notes, and snippets.

import csv
import sys
def main(argv):
inputPricingMap = argv[0]
rows = []
with open(inputPricingMap) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
rows.append(row)
200 OK case:
(venv) preetam-mac:python preetam$ curl -v -X POST --data-binary @post_body localhost:3000/get-price
* Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST /get-price HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.43.0
> Accept: */*
(venv) preetam-mac:python preetam$ curl -v -X POST --data-binary @post_body localhost:3000/match
* Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST /match HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 3664
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
Duration based price:
curl -v -X POST --data-binary @pb_dur "http://localhost:3000/get-price"
> POST /get-price HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 3729
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
+ Running the UP migration
UPDATE 1
UPDATE 1
UPDATE 1
Killed by signal 1.
* migration finished in 0 seconds *
+ Running the DOWN migration
UPDATE 1
UPDATE 1
UPDATE 1
curl -v -X POST --data-binary @pb_dur "http://localhost:3000/get-price"
* Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST /get-price HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 3729
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
{
"request_id": 22660661,
"req_received_sec": 1480379615,
"service_ids": [
2554228,
1010240,
2162761,
387343,
1840180,
1567557,
1 Price columns:
preetam@farnsworth-preetam:~$ sudo -u www-data php /srv/thumbtack/current/bin/maintenance/monetization/update_base_prices.php --csv-path ~/test_cc.csv
Dec 05 20:38:34 [info] Found 2 categories to update.
Dec 05 20:38:34 [info] Found 1 price columns to update. Columns = rca_price_cc
Dec 05 20:38:34 [info] Backing up existing prices to /tmp/tmpp7KNXi3u/price-backup-rca_price_cc-1480970314
Dec 05 20:38:34 [info] Updating record 1: Category ID: 1, column name: rca_price_cc original price: 8,
new price: 8
Dec 05 20:38:34 [info] Updating record 2: Category ID: 2, column name: rca_price_cc original price: 4,
new price: 4
Bid(45995553,22767033,1761703,8556734,Open,1480731888041,1480731888041,Fixed,false,Some(300.0),Some(0),Some(Hi , would like to discuss more details, please feel free to call me at 360-580-7795),Some(2),Some(dynamic_pricing_bottom_20pct_qpr))
curl -v -X POST --data-binary @pb_dur "http://localhost:3000/get-price"
* Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST /get-price HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 3729
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue