Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

392
Views
RestClient is not waiting for api response or sometimes it is giving the response and sometimes it doesn't

I have deployed a python machine learning code using fastapi but sometimes it is giving me the response and sometimes it doesn't. How to force it to wait for API response every time . Please help me I'm having hard time with this.

var client = new RestClient("http://127.0.0.1:8000/predictbuy");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var param = new GannJson1{
         Diff_Step=V1_SStep,
         Last_Swing_Bars=V2_SSwing,
         H1= V3_SH1,
         L1=V4_SL1,
         O1=V5_SO1,
         C1=V6_SC1,
         V1=V7_SV1,
         HiLo1=V8_SHiLo1,
         H2=V9_SH2,
         L2=V10_SL2,
         O2=V11_SO2,
         C2=V12_SC2,
         V2=V13_SV2,
         HiLo2=V14_SHiLo2,
         H3=V15_SH3,
         L3=V16_SL3,
         O3=V17_SO3,
         C3=V18_SC3,
         V3=V19_SV3,
         HiLo3=V20_SHiLo3 
        };
request.AddJsonBody(param);
var response1 = client.Execute(request);
char pred1=(response1.Content)[1];
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Please check this function:

 public async void Function() { var client = new RestClient(); var request = new RestRequest("http://www.google.com"); var cancellationTokenSource = new CancellationTokenSource(); var restResponse = await client.ExecuteAsync(request, cancellationTokenSource.Token); var result = restResponse.Content; }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!