Git Product home page Git Product logo

bing-search-sdk-for-net's Introduction

Project

Bing Search SDK for .NET

This repository is for active development of the Bing API SDK for .NET.

Getting started

To get started with a library, see the README.md file located in the library's project folder. You can find these library folders grouped by service in the /sdk directory.

For tutorials, samples, quickstarts, and other documentation, go to Bing Search .NET SDK Repo.

Need help?

Navigating the repository

Master branch

The master branch has the most recent code with new features and bug fixes.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

bing-search-sdk-for-net's People

Contributors

jaggerbodas-ms avatar josmperez1 avatar mariam-alaa avatar microsoft-github-operations[bot] avatar microsoftopensource avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bing-search-sdk-for-net's Issues

TLS 1.2 Required - Good to Force or at Least Document

Running the Bing SDK with .NET Framework it can cause the server to just disconnect the client when TLS 1.2 has not been forced since the Bing service requires this.

It would be good to either force this or to document it to assist others. The line of required code is:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

VisualSearch fails with Unauthorized despite valid key

I feel I must be missing something obvious here. I've been trying to follow the instructions at https://docs.microsoft.com/en-us/bing/search-apis/bing-visual-search/quickstarts/sdk/visual-search-client-library-csharp. I created a "Bing Search" service in Azure with the S9 tier which supports Visual Search. I went to the Keys and Endpoint section and copied the Key 1 out and put it in the below code, yet every time I run it I get Unauthorized:

{"code":"401","message": "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}
var client = new VisualSearchClient(new Microsoft.Azure.CognitiveServices.Search.VisualSearch.ApiKeyServiceClientCredentials("<key>"));

ImageInfo ImageInfo = new ImageInfo(url: "https://media.vanityfair.com/photos/5d9f5be40fa2040008f28470/4:3/w_1776,h_1332,c_limit/always-sunny-in-philadelphia-hangs-in-there.jpg");
VisualSearchRequest VisualSearchRequest = new VisualSearchRequest(imageInfo: ImageInfo);

var result = await client.Images.VisualSearchMethodAsync(knowledgeRequest: JsonConvert.SerializeObject(VisualSearchRequest));

The instructions don't say anything about setting an endpoint, but I tried that too, setting the Endpoint property from the one in my Keys and Endpoint page:

client.Endpoint = "https://api.bing.microsoft.com/";

But that just result in a NotFound error.

I was able to get it working by calling the REST api directly, so I know the key isn't the issue. For now I'm calling the REST API but it's a pretty kludgy API to call so I'd much prefer to use the SDK, especially since I can't get the REST code working when uploading an image instead of providing a URL: https://github.com/microsoft/bing-search-dotnet-samples/issues/4

Anyone have any idea what's going on? I tried both keys with no success. Here's a LINQPad repro of the issue: http://share.linqpad.net/c3p8vo.linq

VisualSearch fails when providing image as a FileStream

I've been trying to use the VisualSearch sdk and struggling with it. After figuring out this issue #7 I'm now unable to provide the image as a stream instead of a URL:

This works, returning a few of the actors in the image:

var client = new VisualSearchClient(new ApiKeyServiceClientCredentials(Util.GetPassword("BingVisualSearchKey")));

string imageUrl = "https://roost.nbcuni.com/bin/viewasset.html/content/dam/Peacock/Landing-Pages/library/theoffice/mainpage/2-0-design-updates/the-office-main-hero-d.jpg/_jcr_content/renditions/original.JPEG?downsize=3840:*&output-quality=75";

var ImageInfo = new Microsoft.Bing.VisualSearch.Models.ImageInfo(url: imageUrl);
VisualSearchRequest visualSearchRequest = new VisualSearchRequest(imageInfo: ImageInfo);
var result = await client.Images.VisualSearchMethodAsync(knowledgeRequest: JsonConvert.SerializeObject(visualSearchRequest));

But this just returns a mostly empty ImageKnowledge object, no matter which image I provide:

using var stream = File.OpenRead("image.jpg");
var result = await client.Images.VisualSearchMethodAsync(image: stream, knowledgeRequest:(string)null);

I suspect there's a bug in the SDK, as I'm basically following the documentation here exactly https://docs.microsoft.com/en-us/bing/search-apis/bing-visual-search/quickstarts/sdk/visual-search-client-library-csharp

ACTION REQUIRED: Microsoft needs this private repository to complete compliance info

There are open compliance tasks that need to be reviewed for your bing-search-sdk-for-net repo.

Action required: 1 compliance task

To bring this repository to the standard required for 2021, we require administrators of this and all Microsoft GitHub repositories to complete a small set of tasks within the next 60 days. This is critical work to ensure the compliance and security of your microsoft GitHub organization.

Please take a few minutes to complete the task at: https://repos.opensource.microsoft.com/orgs/microsoft/repos/bing-search-sdk-for-net/compliance

  • The GitHub AE (GitHub inside Microsoft) migration survey has not been completed for this private repository

You can close this work item once you have completed the compliance tasks, or it will automatically close within a day of taking action.

If you no longer need this repository, it might be quickest to delete the repo, too.

GitHub inside Microsoft program information

More information about GitHub inside Microsoft and the new GitHub AE product can be found at https://aka.ms/gim or by contacting [email protected]

FYI: current admins at Microsoft include @almaasrawi, @AshPartha, @arwong, @jianghaolu, @Vin5, @Mariam-Alaa, @bogeyorpar, @tdjin, @AlekhyaSasi, @jaggerbodas-ms, @tongyliu, @javedfgiet

VideoObject.ViewCount is too small datatype (int) to parse result

Microsoft.Rest.SerializationException: Unable to deserialize the response.
 ---> Newtonsoft.Json.JsonReaderException: JSON integer 3041937658 is too large or small for an Int32. Path 'videos.value[0].viewCount', line 1, position 27297.
   at Newtonsoft.Json.JsonTextReader.ParseReadNumber(ReadType readType, Char firstChar, Int32 initialPosition)
   at Newtonsoft.Json.JsonTextReader.ParseNumber(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ReadNumberValue(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ReadAsInt32()

When searching for "hello"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.