This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import request | |
@app.route('/ipn_handler', methods=['GET', 'POST']) | |
def ipn_handler(): | |
from pay_with_amazon.ipn_handler import IpnHandler | |
response = IpnHandler(request.data, request.headers) | |
if response.authenticate(): | |
return(response.to_json()) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filetype off | |
execute pathogen#infect() | |
set nocompatible | |
filetype indent plugin on | |
syntax on | |
colo fraket | |
set modeline | |
set number | |
set tabstop=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Amazon Advertising API | |
Example API call to self-register for sandbox access. Country code can be one of the following: | |
US, CA, UK, DE, FR, ES, IT, IN, CN, JP | |
curl -X PUT \ | |
-H "Authorization: Bearer ACCESS_TOKEN" \ | |
-H "Content-Type: application/json" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* requestReport */ | |
$req = $client->requestReport( | |
"productAds", | |
array("reportDate" => "20160916", | |
"campaignType" => "sponsoredProducts", | |
"metrics" => "impressions,clicks,cost,attributedConversions30dSameSKU,attributedConversions30d,attributedSales30dSameSKU,attributedSales30d")); | |
/* getReport */ | |
$req = $client->getReport("REPORT_ID"); | |
file_put_contents("/Users/dbrent/Downloads/report.json", $req["response"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note that this is sandbox. If you have not registered profiles in sandbox you | |
will need to do so prior to making these calls. You will also need at least | |
one campaign, ad group, and keyword before you see anything in the report. | |
While in sandbox, we will return “dummy” data so that you can see how an actual | |
report would look. | |
To make it look nicer, I always export my access token prior to making calls. | |
You could do the same for API-Scope (profile Id) if you wish. Make sure to use | |
quotes around the access token if it isn’t URL encoded. It has a | (pipe) | |
symbol and your shell won’t like it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function jsonPrettyPrint($request) | |
{ | |
$json = $request["response"]; | |
$result = ''; | |
$level = 0; | |
$in_quotes = false; | |
$in_escape = false; | |
$ends_line_level = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl \ | |
-H "Content-Type:application/x-www-form-urlencoded;charset=UTF-8" \ | |
-d "grant_type=refresh_token&client_id=YOUR_CLIENT_ID&refresh_token=YOUR_REFRESH_TOKEN&client_secret=YOUR_CLIENT_SECRET" \ | |
https://api.amazon.com/auth/o2/token |
OlderNewer