Jump to content

Import Requests

Recommended Posts



I´m trying to import and use "resquests" from python on delphi.


Already did a bit of the path, but can´t use get in the righ way;


on Python i´m using :


import requests

def test():
    response = requests.get('', auth=requests.HTTPDigestAuth('admin','admin'), stream=True, timeout=60)


on Delphi i´m trying to import requests and use it on my code:


  request, response: TVariant;
  request := import('requests');
  response := request.get('URL STRING'); //<<-- here i need to insert the args used on python call such as auth=request.auth.HTTPDigestAuth('user','pass'), stream=True, timeout=60

how can i use the functions and methods with args on delphi ?



Share this post

Link to post

P4D supports named parameters as follows:


requests.get('', auth:=requests.HTTPDigestAuth('admin','admin')

Please note the := notation.   

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now