static void Main(string[] args) { Console.WriteLine("------------------------------------------"); Console.WriteLine("Please insert accesskey"); var accessKey = Console.ReadLine(); Console.WriteLine("Please insert secretkey"); var secretKey = Console.ReadLine(); Console.WriteLine("------------------------------------------"); var authentication = new AmazonAuthentication(); authentication.AccessKey = accessKey; authentication.SecretKey = secretKey; //LookupCheck.ItemLookupRequest(authentication); //ItemSearchRequest(authentication); //CustomItemSearchRequest1(authentication); //CustomItemSearchRequest2(authentication); //BrowseNodeLookupRequest1(authentication); //BrowseNodeLookupRequest2(authentication); //BrowseNodeLookupRequest2(authentication); //CreateCart1(authentication); Console.ReadLine(); }
static void CustomItemSearchRequest2(AmazonAuthentication authentication) { Console.WriteLine("Search with BrowseNode"); Console.WriteLine("------------------------------------------"); var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE); var customOperation = new AmazonOperationBase(); customOperation.ParameterDictionary.Add("Operation", "ItemSearch"); customOperation.ParameterDictionary.Add("Keywords", "tall"); customOperation.ParameterDictionary.Add("SearchIndex", "Apparel"); customOperation.ParameterDictionary.Add("BrowseNode", "78193031"); customOperation.ParameterDictionary.Add("AssociateTag", "nagerat-21"); var webResponse = wrapper.Request(customOperation); var result = XmlHelper.ParseXml <ItemSearchResponse>(webResponse.Content); foreach (var item in result.Items.Item) { Console.WriteLine(item.ItemAttributes.Title); } Console.WriteLine("found {0} items", result.Items.Item.Length); Console.WriteLine("------------------------------------------"); }
public static List <PriceSourceItemOld> SearchLookup(string term, AmazonEndpoint?endpoint = null) { List <PriceSourceItemOld> results = new List <PriceSourceItemOld>(); List <Endpoint> endpointsToSearch = new List <Endpoint>(); if (endpoint != null) { endpointsToSearch.Add(Endpoints.Get(endpoint.Value)); } else { endpointsToSearch.AddRange(Endpoints.EndpointsList); } foreach (var endpointItem in endpointsToSearch) { var authentication = new AmazonAuthentication(); authentication.AccessKey = endpointItem.accessKey; authentication.SecretKey = endpointItem.secreteKey; endpoint = (AmazonEndpoint)Enum.Parse(typeof(AmazonEndpoint), endpointItem.endpointCode); var wrapper = new AmazonWrapper(authentication, endpoint.Value, endpointItem.merchantId); string searchTerm = "ASUS DUAL-RX580-O8G Radeon RX 580 8 GB GDDR5"; //string searchTerm = //"B076GZ3JFC"; AmazonItemResponse result = wrapper.Lookup(term); results.AddRange(result.ToPriceSourceItems()); } return(results); }
////https://www.grosbill.com/3-disque_dur-3.5-type-informatique ////http://www.materiel.net/disque-dur/ //var auth = new AmazonAuthentication(); //auth.AccessKey = ""; //auth.SecretKey = ""; //var wrapper = new AmazonWrapper(auth, AmazonEndpoint.FR); //foreach(HDD di in lstProd2) //{ // var lstReslt = wrapper.Search(di.Nom, AmazonSearchIndex.Electronics); // if (lstReslt != null && lstReslt.Items!=null && lstReslt.Items.Item!=null) // { // foreach (Item item in lstReslt.Items.Item) // { // Debug.WriteLine("modèle : " + item.ItemAttributes?.Model + " marque : " + item.ItemAttributes?.Brand + " price : " + item.ItemAttributes?.ListPrice?.FormattedPrice); // } // } //} public static async void AmazonExtractor(ObservableCollection <HDD> lstProdIn, ObservableCollection <HDD> LstProdOut) { var auth = new AmazonAuthentication(); auth.AccessKey = ""; auth.SecretKey = ""; var wrapper = new AmazonWrapper(auth, AmazonEndpoint.FR, ""); ObservableCollection <HDD> lstTmp = new ObservableCollection <HDD>(lstProdIn.ToList()); foreach (HDD di in lstTmp) { var lstReslt = wrapper.Search(di.Nom, AmazonSearchIndex.Electronics); if (lstReslt != null && lstReslt.Items != null && lstReslt.Items.Item != null) { foreach (Item item in lstReslt.Items.Item) { // Debug.WriteLine("modèle : " + item.ItemAttributes?.Model + " marque : " + item.ItemAttributes?.Brand + " price : " + item.ItemAttributes?.ListPrice?.FormattedPrice); await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { LstProdOut.Add(new HDD() { Nom = item.ItemAttributes?.Brand + " " + item.ItemAttributes?.Model, Prix = float.Parse(item.ItemAttributes?.ListPrice?.FormattedPrice.Replace("EUR ", "")) }); })); } } } }
static void Main(string[] args) { //Authentication var authentication = new AmazonAuthentication(); authentication.AccessKey = "amazon access key here"; authentication.SecretKey = "amazon secret key here"; //Search critera and result var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.US, "amazon associate tag here"); var searchOperation = wrapper.ItemSearchOperation("canon eos", AmazonSearchIndex.Electronics); searchOperation.MaxPrice(200000); //2000 USD var xmlResponse = wrapper.Request(searchOperation); var result = XmlHelper.ParseXml <ItemSearchResponse>(xmlResponse.Content); //Create cart and add items to it var items = new List <AmazonCartItem>(); items.Add(new AmazonCartItem("item code here")); var cart = wrapper.CartCreate(items); //Debuging /*wrapper.XmlReceived += (xml) => { System.Diagnostics.Debug.WriteLine(xml); }; * wrapper.ErrorReceived += (errorResonse) => { System.Diagnostics.Debug.WriteLine(errorResonse.Error.Message); }; * var errors = wrapper.Lookup(new string[] { "item code here" });*/ }
public SearchNode GetSearchNode(long searchNodeId) { SearchNode result = new SearchNode() { Id = searchNodeId }; var authentication = new AmazonAuthentication(); authentication.AccessKey = this._amazonAccessKey; authentication.SecretKey = this._amazonSecretKey; var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.IT, this._amazonPartnerId); wrapper.ErrorReceived += (errorResonse) => { _logger.LogError(errorResonse.Error.Message); }; BrowseNodeLookupResponse nodelookup = wrapper.BrowseNodeLookup(searchNodeId, AmazonResponseGroup.BrowseNodeInfo); if (nodelookup.BrowseNodes.Request.IsValid == "True") { result.Name = nodelookup.BrowseNodes.BrowseNode.Name; foreach (var item in nodelookup.BrowseNodes.BrowseNode.Children) { result.SearchSubNodes.Add(GetSearchNode(Convert.ToInt64(item.BrowseNodeId))); } } return(result); }
public static AmazonWrapper GetAmazonWrapper(string tag) { var authentification = new AmazonAuthentication(); authentification.AccessKey = APIKeys.AmazonAccessKey; authentification.SecretKey = APIKeys.AmazonSecretKey; return(new AmazonWrapper(authentification, AmazonEndpoint.JP, tag)); }
private AmazonWrapper PrepareAmazonWrapper() { var auth = new AmazonAuthentication(); auth.AccessKey = Configuration.AmazonAPIAccessKey; auth.SecretKey = Configuration.AmazonAPISecretKey; return(new AmazonWrapper(auth, AmazonEndpoint.US, Configuration.AmazonAssociateTag)); }
public AmazonApiSearcher() { var authentication = new AmazonAuthentication { AccessKey = AccessKey, SecretKey = SecretKey }; this._apiWwrapper = new AmazonWrapper(authentication, AmazonEndpoint.CA); }
public static AmazonAuthentication GetAuthentication() { var authentication = new AmazonAuthentication { AccessKey = AccesKeyId, SecretKey = SecretKeyId }; return(authentication); }
public void TestInitialize() { var accessKey = ""; var secretKey = ""; var parnterTag = ""; var endpoint = AmazonEndpoint.DE; var amazonAuthentication = new AmazonAuthentication(accessKey, secretKey); this._client = new AmazonProductAdvertisingClient(amazonAuthentication, endpoint, parnterTag, strictJsonMapping: true); }
static void Main3(string[] args) { var authentification = new AmazonAuthentication { AccessKey = APIKeys.AmazonAccessKey, SecretKey = APIKeys.AmazonSecretKey }; var w = new AmazonWrapper(authentification, AmazonEndpoint.JP, "kurema-22"); //var AmazonRequiredResponse = Nager.AmazonProductAdvertising.Model.AmazonResponseGroup.ItemAttributes | Nager.AmazonProductAdvertising.Model.AmazonResponseGroup.Images | Nager.AmazonProductAdvertising.Model.AmazonResponseGroup.OfferSummary; var s = w.Search("倫理 哲学", responseGroup: Nager.AmazonProductAdvertising.Model.AmazonResponseGroup.Large); }
private AmazonAuthentication GetConfig() { var accessKey = Environment.GetEnvironmentVariable("ACCESS_KEY"); var secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); var authentication = new AmazonAuthentication(); authentication.AccessKey = accessKey; authentication.SecretKey = secretKey; return(authentication); }
private AmazonAuthentication GetConfig() { var accessKey = ConfigurationManager.AppSettings["AmazonAccessKey"]; var secretKey = ConfigurationManager.AppSettings["AmazonSecretKey"]; var authentication = new AmazonAuthentication(); authentication.AccessKey = accessKey; authentication.SecretKey = secretKey; return(authentication); }
public AmazonApiInspector(AmazonSource source) { this._source = source; var authentication = new AmazonAuthentication { AccessKey = AccessKey, SecretKey = SecretKey }; this._apiWwrapper = new AmazonWrapper(authentication, AmazonEndpoint.CA); }
public void TestInitialize() { // read config string accessKey = TestContext.Properties["accessKey"].ToString(); string secretKey = TestContext.Properties["secretKey"].ToString(); string parnterTag = TestContext.Properties["parnterTag"].ToString(); AmazonEndpoint endpoint = Enum.Parse <AmazonEndpoint>(TestContext.Properties["endpoint"].ToString()); // setup client var amazonAuthentication = new AmazonAuthentication(accessKey, secretKey); this._client = new AmazonProductAdvertisingClient(amazonAuthentication, endpoint, parnterTag, strictJsonMapping: true); }
public AmazonClient(AppSettings appSettings) { AssociateTag = appSettings.AssociateTag; AmazonWebServiceNameSpace = appSettings.AmazonWebServiceNameSpace; AmazonAuthentication = new AmazonAuthentication { AccessKey = appSettings.AccessKey, SecretKey = appSettings.SecretKey }; AmazonWrapper = new AmazonWrapper(AmazonAuthentication, AmazonEndpoint.US, appSettings.AssociateTag); }
private bool IsValidAuthentication(AmazonAuthentication authentication) { if (String.IsNullOrEmpty(authentication.AccessKey) || String.IsNullOrEmpty(authentication.SecretKey)) { this.textBoxAccessKey.BackColor = Color.OrangeRed; this.textBoxSecretKey.BackColor = Color.OrangeRed; return(false); } this.textBoxAccessKey.BackColor = Color.White; this.textBoxSecretKey.BackColor = Color.White; return(true); }
static void BrowseNodeLookupRequest2(AmazonAuthentication authentication) { Console.WriteLine("BrowseNodeLookup - BrowseNodes"); Console.WriteLine("------------------------------------------"); var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE); var result = wrapper.BrowseNodeLookup(78193031, AmazonResponseGroup.BrowseNodeInfo); foreach (var item in result.BrowseNodes.BrowseNode.Children) { Console.WriteLine(item.BrowseNodeId); } Console.WriteLine("------------------------------------------"); }
static void CreateCart1(AmazonAuthentication authentication) { Console.WriteLine("CreateCart1"); Console.WriteLine("------------------------------------------"); var items = new List <AmazonCartItem>(); items.Add(new AmazonCartItem("B00MH4QM1S")); items.Add(new AmazonCartItem("B01EUHFAC6")); var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE); var result = wrapper.CartCreate(items); Console.WriteLine("------------------------------------------"); }
// GET: Search public ActionResult Search(string keyword, string page, string currency) { //KEYS string amazonAccessKey = "ABC"; string amazonSecretKey = "ABC"; string associateTag = "ABC"; if (String.IsNullOrEmpty(keyword)) { return(View()); } //Makes sure when the user types the url out of bounds, it returns the user to page 1-6 int pageNum = Int32.Parse(page); if (pageNum < 1) { pageNum = 1; } else if (pageNum > 6) { pageNum = 6; } //Send info to view ViewBag.Search = keyword; ViewBag.Page = pageNum; ViewBag.NextPage = pageNum + 1; ViewBag.PrevPage = pageNum - 1; ViewBag.Currency = currency; //Authentication with keys var authentication = new AmazonAuthentication(); authentication.AccessKey = amazonAccessKey; authentication.SecretKey = amazonSecretKey; //API request var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.UK, associateTag); var responseGroup = AmazonResponseGroup.ItemAttributes | AmazonResponseGroup.Images | AmazonResponseGroup.Offers | AmazonResponseGroup.OfferFull; var searchOperation = wrapper.ItemSearchOperation(keyword, AmazonSearchIndex.All, responseGroup); searchOperation.Skip(pageNum); var xml = wrapper.Request(searchOperation); var result = XmlHelper.ParseXml <ItemSearchResponse>(xml.Content); return(View(result)); }
public void TestMethod1() { var authentication = new AmazonAuthentication(); authentication.AccessKey = "[AccessKey]"; authentication.SecretKey = "[SECRET]"; var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.ES, "desincuentos-21"); wrapper.ErrorReceived += response => { var error = response; }; var res = wrapper.BatchItemLookupOperation(new List <string> { "B01I4QAERA", "B07H42TBTD", "B075CK3GVJ", "B01CJYNBBY", "B01A9GM5X4", "B00ZB9QJ5K", "B005QJOQEG", "B06XXZLCD2", "B019HAOZ3G", "B01I4QAERA", "B07H42TBTD", "B075CK3GVJ", "B01CJYNBBY", "B01A9GM5X4", "B00ZB9QJ5K", "B005QJOQEG", "B06XXZLCD2", "B019HAOZ3G", "B019HAOZ3G", "B019HAOZ3G" }); }
static void ItemSearchRequest2(AmazonAuthentication authentication) { Console.WriteLine("ItemSearch"); Console.WriteLine("------------------------------------------"); var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE); var result = wrapper.Search("canon eos", AmazonSearchIndex.Electronics, AmazonResponseGroup.Images | AmazonResponseGroup.Similarities); foreach (var item in result.Items.Item) { Console.WriteLine($"ASIN:{item.ASIN}, SimilarCount:{item.SimilarProducts.Length}"); } Console.WriteLine("found {0} items", result.Items.Item.Length); Console.WriteLine("------------------------------------------"); }
private void buttonOk_Click(object sender, EventArgs e) { var authentication = new AmazonAuthentication(); authentication.AccessKey = this.textBoxAccessKey.Text; authentication.SecretKey = this.textBoxSecretKey.Text; if (!this.IsValidAuthentication(authentication)) { return; } this.Authentication = authentication; this.DialogResult = DialogResult.OK; this.Close(); }
static void ItemSearchRequest(AmazonAuthentication authentication) { Console.WriteLine("ItemSearch"); Console.WriteLine("------------------------------------------"); var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE); var result = wrapper.Search("canon eos", AmazonSearchIndex.Electronics, AmazonResponseGroup.Large); foreach (var item in result.Items.Item) { Console.WriteLine(item.ItemAttributes.Title); } Console.WriteLine("found {0} items", result.Items.Item.Length); Console.WriteLine("------------------------------------------"); }
public AmazonCrawler( CrawlerOptions secrets, ApplicationDbContextFactory dbContextFactory, ILoggerFactory loggerFactory) { this.dbContextFactory = dbContextFactory; logger = loggerFactory.CreateLogger <AmazonCrawler>(); var authentication = new AmazonAuthentication() { AccessKey = secrets.PaApiAccessKeyId, SecretKey = secrets.PaApiSecretKey, }; client = new AmazonWrapper( authentication, AmazonEndpoint.JP, secrets.PaApiAssociateTag); }
static void BrowseNodeLookupRequest(AmazonAuthentication authentication) { //http://docs.aws.amazon.com/AWSECommerceService/latest/DG/localevalues.html Console.WriteLine("BrowseNodeLookup"); Console.WriteLine("------------------------------------------"); var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE); var result = wrapper.BrowseNodeLookup(569604, AmazonResponseGroup.Large); foreach (var item in result.BrowseNodes.BrowseNode.Children) { Console.WriteLine(item.BrowseNodeId); } //Console.WriteLine("found {0} items", result.Items.Item.Length); Console.WriteLine("------------------------------------------"); }
public Tuple <string, List <SimilarBooks> > GetDetails(string isbn) { var accessKey = ConfigurationManager.AppSettings["AmazonAccessKey"]; var secretKey = ConfigurationManager.AppSettings["AmazonSecretKey"]; var associateTag = ConfigurationManager.AppSettings["AmazonAssociateTag"]; var authentication = new AmazonAuthentication(); authentication.AccessKey = accessKey; authentication.SecretKey = secretKey; var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE, associateTag); var result = wrapper.Lookup(isbn); var item = result?.Items?.Item?.FirstOrDefault(); var asins = item?.SimilarProducts?.Select(o => o.ASIN).ToList(); if (asins == null) { return(new Tuple <string, List <SimilarBooks> >(item?.LargeImage?.URL, null)); } var similarBooksRequest = wrapper.Lookup(asins); if (similarBooksRequest == null) { Thread.Sleep(1000); similarBooksRequest = wrapper.Lookup(asins); } var similarBooks = similarBooksRequest?.Items?.Item?.Select(o => new SimilarBooks() { Isbn = o.ItemAttributes.EAN, Title = o.ItemAttributes.Title, Verfasser = o.ItemAttributes.Author?.FirstOrDefault(), ImageUrl = o.MediumImage?.URL, Url = o.DetailPageURL }).ToList(); return(new Tuple <string, List <SimilarBooks> >(item?.LargeImage?.URL, similarBooks)); }
static void BrowseNodeLookupRequest1(AmazonAuthentication authentication) { Console.WriteLine("BrowseNodeLookup - TopSellers"); Console.WriteLine("------------------------------------------"); var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE); var result = wrapper.BrowseNodeLookup(78193031, AmazonResponseGroup.TopSellers); foreach (var item in result.BrowseNodes.BrowseNode.TopSellers.TopSeller) { Console.WriteLine("{0} {1}", item.ASIN, item.Title); } foreach (var item in result.BrowseNodes.BrowseNode.TopItemSet.TopItem) { Console.WriteLine("{0} {1} {2}", item.ASIN, item.ProductGroup, item.Title); } Console.WriteLine("------------------------------------------"); }
public void SearchTopSellerItems(string keywords, long searchNode, int minPrice, int maxPrice, bool searchSubNodes, Enums.SearchSort searchSort, Enums.SearchSortOrder searchSortOrder) { var authentication = new AmazonAuthentication(); authentication.AccessKey = this._amazonAccessKey; authentication.SecretKey = this._amazonSecretKey; var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.IT, this._amazonPartnerId); wrapper.ErrorReceived += (errorResonse) => { _logger.LogError(errorResonse.Error.Message); }; var searchNodeTopSeller = wrapper.BrowseNodeLookup(searchNode, AmazonResponseGroup.BrowseNodeInfo | AmazonResponseGroup.TopSellers); var test33 = wrapper.ItemLookupOperation(new List <string> { "B00PAZYAT2", "B007SGHF3Y" }, AmazonResponseGroup.Small | AmazonResponseGroup.BrowseNodes | AmazonResponseGroup.SalesRank | AmazonResponseGroup.ItemAttributes); test33.ParameterDictionary.Add("MerchantId", "Amazon"); var xmlResponseTT = wrapper.Request(test33); var parsedTT = XmlHelper.ParseXml <ItemLookupResponse>(xmlResponseTT.Content); }