Skip to main content

besocurl

A library for HTTP / HTTPs requests that supports SSPI and PAC file parsing(Automatic proxy settings detection) besoCurl by Omri Baso
Date: 21/10/2020
All right reserved to Omri Baso for this library
credits for pieces of code taken from other places are inside the code
some code was taken from the Px project
https://github.com/genotrance/px/blob/master/px.py
Download pycurl from: https://dl.bintray.com/pycurl/pycurl/

Dependencies:

  pycurl-7.43.0.2  (I added the installiation for Windows that matchs python 3.6 because thats the one i used to build this library)  
  python 3.x 
  Installtion:  
  Windows:
        1. Install pycurl.exe from here to your python version https://dl.bintray.com/pycurl/pycurl/
  Linux:
        1. apt install libcurl4-openssl-dev libssl-dev  
        2. apt install python-dev python3-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev  
        3. python3 -m pip install setuptools wheel pycurl  

Technical Information

the besoCurl project comes to make Pycurl more human usable while implmenting more automatic approch to the library, the library supports SSPI authentication to proxies over HTTP or HTTP(s) besoCurl has simple functions such as:

import besoCurl
def main():  
    url = 'http://192.168.189.136/'
    useragents = 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; Safari/537.36'  
    headers = ["Accept: OmriBeso", "Content-type: application/json"]  
    r = besoCurl.get(url, headers=headers, user_agent=useragents, auto_detect_proxy=True)  
    print(r.text)  
main()  

OR for a post request

import besoCurl
def main():
    url = 'http://192.168.189.136/'
    useragents = 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; Safari/537.36'
    headers = ["Accept: OmriBeso", "Content-type: application/json"]
    r = besoCurl.post(url, data=data, headers=headers, user_agent=user_agent, auto_detect_proxy=True)
    print(r.text)
main()    

the code infront of you will return the HTML content of the url inserted into the function,
user the User-Agent set to it and the headers. also - auto_detect_proxy=True will try to fetch the windows settings for accessing the internet. if a PAC file is configured it will download it and parse the Javascript in order for you go through
the proxy, if a PAC file is configured AND a manual proxy is set, it will choose the PAC path instead.
if only a manual proxy is set it will use it, if no proxy is configured i will not use any proxies and go directly to the internet.
if a proxy is set, the HTTP request will use SSPI to authenticate to the proxy without entering any credentials.
More Information about how it works: https://docs.microsoft.com/en-us/windows/win32/rpc/security-support-provider-interface-sspi-
In general i recommend to use auto_detect_proxy=True all the time.
you can also set a proxy manully when invoking a request as the variables proxies=[("127.0.0.1", 8080)]
proxies must have the format mentioned above.
TODO:

  1. add WPAD (Auto Detect Settings support) - DONE 06/01/2021,
  2. add PUT method, - DONE 06/01/2021
  3. and multipart forms on POST requests
  4. add session options so request will not authenticate everyime they are sent all over again

Metadata

Release files for besocurl 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for besocurl 0.0.4
File Size Uploaded
besocurl-0.0.4.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for besocurl 0.0.4
File Interpreter ABI Platform
besocurl-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 27.6 kB

Release files / besocurl-0.0.4.tar.gz

Download URL besocurl-0.0.4.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c1f61b319bb98833dbf9284f04f9fb88b4ae99d5dac2e38ed291a43b2a9791dd
BLAKE2b-256 checksum
How to use checksums
023b4b689d363a54703bfc84ea9d11f66de8cb0eee31fe384142b9ede4e28823
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.8.6

Release files / besocurl-0.0.4-py3-none-any.whl

Download URL besocurl-0.0.4-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b55f2ed2bef847ee87064433b6b8881b624639a2ce194ce1efd7cfa69d51b36
BLAKE2b-256 checksum
How to use checksums
3e11052a2eb8560d17295b635ed22307674b96e0c3d7c11f13e69b7a5ca380bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.8.6

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page