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 260975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:23:35+00:00 2026-05-11T22:23:35+00:00

Microsoft provides a method as part of WinHTTP which allows a user to determine

  • 0

Microsoft provides a method as part of WinHTTP which allows a user to determine which Proxy ought to be used for any given URL. It’s called WinHttpGetProxyForUrl.

Unfortunately I’m programming in python so I cannot directly access this function – I can use Win32COM to call any Microsoft service with a COM interface.

So is there any way to get access to this function from Python? As an additional problem I’m not able to add anything other than Python to the project. That means however convenient it is impossible to add C# or C++ fixes.

I’m running Python2.4.4 with Win32 extensions on Windows XP.

Update 0:

This is what I have so far:

import win32inet
import pprint
hinternet = win32inet.InternetOpen("foo 1.0", 0, "", "", 0)
# Does not work!!!
proxy = win32inet.WinHttpGetProxyForUrl( hinternet, u"http://www.foo.com", 0  )

Obviously the last line is wrong, however I cannot see any docs or examples on the right way to do it!

Update 1:

I’m going to re-ask this as a new question since it’s now really about win32com.

  • 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-05-11T22:23:36+00:00Added an answer on May 11, 2026 at 10:23 pm

    You can use ctypes to call function in WinHttp.dll, it is the DLL which contains ‘WinHttpGetProxyForUrl. ‘
    Though to call it you will need a HINTERNET session variable, so here I am showing you the first step, it shows how you can use ctypes to call into DLL,it produces a HINTERNET which you have to pass to WinHttpGetProxyForUrl, that I will leave for you as exercise, if you feel difficulty POST the code I will try to fix it.

    Read more about ctypes @ http://docs.python.org/library/ctypes.html

    import ctypes
    
    winHttp = ctypes.windll.LoadLibrary("Winhttp.dll")
    
    WINHTTP_ACCESS_TYPE_DEFAULT_PROXY=0
    WINHTTP_NO_PROXY_NAME=WINHTTP_NO_PROXY_BYPASS=0
    WINHTTP_FLAG_ASYNC=0x10000000
    # http://msdn.microsoft.com/en-us/library/aa384098(VS.85).aspx
    HINTERNET = winHttp.WinHttpOpen("PyWin32", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, WINHTTP_FLAG_ASYNC)
    
    print HINTERNET
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Much as the question states, there is Microsoft.Office.Interop.Excel.Extensions (part of VSTO Power Tools )which
are there any additional WPF themes from microsoft except that default ones provided in
Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring
I've got a class called EcmaEval which allows users of my application execute arbitary
I am writing a program which utilises the System.Reflection namespace of the Microsoft .NET
In my C# application I am using the Microsoft Jet OLEDB data provider to
So I have learned that that the Microsoft.Jet.OLEDB.4.0 data provider for querying data sources
Microsoft recently announced that the Javascript/HTML DOM library jQuery will be integrated into the
Microsoft's new Windows Live Application Based Storage API is a RESTful API. More info
Microsoft Access is a slick way to access data in a MS SQL Server

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.