Jump to content
Joao

Import Requests

Recommended Posts

Hi,

 

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('http://192.168.1.200/gci-bin/users', auth=requests.HTTPDigestAuth('admin','admin'), stream=True, timeout=60)
    print(response.text)

 

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

 

var
  request, response: TVariant;
begin
  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
  showmessage(response.text);
end;


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('http://192.168.1.200/gci-bin/users', 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

×