Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8321339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:58:55+00:00 2026-06-08T22:58:55+00:00

So, I ve made corrections based on most of the answers under the same

  • 0

So, I ve made corrections based on most of the answers under the same roof in stack overflow, I’m still unable to resolve this problem.

queryBingFor = "Google Fibre"
quoted_query = urllib.quote(queryBingFor)
account_key = "dslfkslkdfhsehwekhrwkj2187iwekjfkwej3"

rootURL = "https://api.datamarket.azure.com/Bing/Search/v1/"
searchURL = rootURL + "Image?format=json&Query=" + quoted_query
cred = base64.encodestring(accountKey)

reqBing = urllib2.Request(url=searchURL)
author = "Basic %s" % cred
reqBing.add_header('Authorization',author)

readURL = urllib2.urlopen(reqBing)

I know I’m missing out something in the above code, that gives me a:

urllib2.HTTPError: HTTP Error 401: The authorization type you provided is not supported.  Only Basic and OAuth are supported

Any clue on what the problem could be?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:58:57+00:00Added an answer on June 8, 2026 at 10:58 pm

    So, here’s the working code. The problem I was creating is the query keywords’ format.

     queryBingFor = "'google fibre'" # the apostrophe's required as that is the format the API Url expects. 
     quoted_query = urllib.quote(queryBingFor)
    
     rootURL = "https://api.datamarket.azure.com/Bing/Search/"
     searchURL = rootURL + "Image?$format=json&Query=" + quoted_query
    
     password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
     password_mgr.add_password(None, searchURL,username,accountKey)
    
     handler = urllib2.HTTPBasicAuthHandler(password_mgr)
     opener = urllib2.build_opener(handler)
     urllib2.install_opener(opener)
     readURL = urllib2.urlopen(searchURL).read()
    

    This should give the results in the respective JSON format. As I’m using urllib2’s httpbasicauthhandler, the password’s converted into base64 implicitly, I presume.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made the following query based on many tutorials from blogs and answers on
Made this nice little loop for hiding and showing div's, works as a charm
I've followed a tutorial in MVC 3, and done this: Made 4 classes and
I have to create a log file for all internet connections made by PC.
Is there any way that I can track the connections made to my application's
I made a program: import collections x = input(Enter in text: ) x_counter =
Made a custom obj called Item with some string fields and one float. .h
I made a dll in c# but i need to export the functions. Is
I made an iphone app to capture image from camera and to set that
I made a Web service in which I have a function to count some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.