Recent

Author Topic: GoogleApi Drive Example - Doesn't compile  (Read 7017 times)

mgc

  • New member
  • *
  • Posts: 7
Re: GoogleApi Drive Example - Doesn't compile
« Reply #15 on: May 08, 2022, 09:29:13 pm »
Still the same problem in 2022:

Code: Pascal  [Select][+][-]
  1. frmmain.pp(128,13) Error: identifier idents no member "downloadUrl"
  2. ... and go on
  3.  


Suspect I have different versions of client and demos.

dbannon

  • Hero Member
  • *****
  • Posts: 2021
    • tomboy-ng, a rewrite of the classic Tomboy
Re: GoogleApi Drive Example - Doesn't compile
« Reply #16 on: May 09, 2022, 04:13:16 am »
I have been working through all the examples in Lazarus and I have marked the Google API ones as "Needs work".  I suspect, but do not know, that it relates to the fact that Google have changed their auth model, quite a lot of old, and not so old, code will not connect. And Lazarus is no different.

Be great if someone who knows better could chime in ....

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

dbannon

  • Hero Member
  • *****
  • Posts: 2021
    • tomboy-ng, a rewrite of the classic Tomboy
Re: GoogleApi Drive Example - Doesn't compile
« Reply #17 on: May 09, 2022, 04:20:49 am »
« Last Edit: May 09, 2022, 07:53:39 am by dbannon »
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

mgc

  • New member
  • *
  • Posts: 7
Re: GoogleApi Drive Example - Doesn't compile
« Reply #18 on: May 12, 2022, 04:30:36 pm »
The example that does not compile is here, which seems to be older:
https://github.com/alrieckert/lazarus/tree/master/components/googleapis/demo/drive

The example bellows compiles, but there are many, many problems that makes the performance very poor:
https://gitlab.com/dbannon/laz_examples/-/tree/main/General/google_drive

Google has not changed the way we access the APIs, which is still standard OAuth2. I used my ClientID and ClientSecret to get access and it worked perfectly.

The problems in the example code are:
- Opensslsockets is needed in the Uses clause;
- Error in these lines:
   Add(BoolToStr(Entry.capabilities.canEdit,'Yes','No'));
   Add(Entry.lastModifyingUser.displayName);

After compiling it worked, but not always. Many, many times I got the error “google.ini is being used for another process”. Obviously I am using Windows. Then I vanished the Inifiles unit and incorporated the ClientID and ClientSecret into the code and the problem disappeared. However, the performance is still very poor. Sometimes the program freezes, sometimes get fatal errors. Sometimes the program takes forever to close using the X button or Alt+F4.

Going to Linux has not make things better.  The performance is still very poor.

I watched the request.log file and notice that its size keeps growing on minutes after the request to the API. Meanwhile, sometimes it has an “Internal server error”. I concluded that this problem happens due to the large number of folders and sub-folders in my drive. Each folder is a call to the API which makes the process very slow and inefficient.
Least but not last, any sub-folder request results in a “bad request”.

I hope this contribution helped to update the API’s FP client.

Thanks.

Mauricio Camargo

dbannon

  • Hero Member
  • *****
  • Posts: 2021
    • tomboy-ng, a rewrite of the classic Tomboy
Re: GoogleApi Drive Example - Doesn't compile
« Reply #19 on: May 13, 2022, 02:20:05 am »
The example that does not compile is here, which seems to be older:
https://github.com/alrieckert/lazarus/tree/master/components/googleapis/demo/drive
We cannot help you with that one I am afraid.

The example bellows compiles, but there are many, many problems that makes the performance very poor:
https://gitlab.com/dbannon/laz_examples/-/tree/main/General/google_drive
This one is a direct copy of the Lazarus source tree example. And probably the one to concentrate on.  If you use Lazarus main you will find it using the Examples window, older Lazarus has the same thing but sometimes a bit awkward to access. I suspect it has not been looked at for some time.

I thank you for your comments below. I personally do not have any Google Credentials so could not test beyond compiling. And, I expected to see an OAuth2 window open to enter my (non-existing) credentials. Good you can confirm the example is still appropriate even if full of bugs !

I would like to think that there is someone watching with some experience here, if we don't hear from them, I guess we have to assume you are the resident expert in this field !

I will add your comments here as a readme.txt to the example, if we can get some better answers, that would be even better !

Davo
 
Google has not changed the way we access the APIs, which is still standard OAuth2. I used my ClientID and ClientSecret to get access and it worked perfectly.

The problems in the example code are:
- Opensslsockets is needed in the Uses clause;
- Error in these lines:
   Add(BoolToStr(Entry.capabilities.canEdit,'Yes','No'));
   Add(Entry.lastModifyingUser.displayName);

After compiling it worked, but not always. Many, many times I got the error “google.ini is being used for another process”. Obviously I am using Windows. Then I vanished the Inifiles unit and incorporated the ClientID and ClientSecret into the code and the problem disappeared. However, the performance is still very poor. Sometimes the program freezes, sometimes get fatal errors. Sometimes the program takes forever to close using the X button or Alt+F4.

Going to Linux has not make things better.  The performance is still very poor.

I watched the request.log file and notice that its size keeps growing on minutes after the request to the API. Meanwhile, sometimes it has an “Internal server error”. I concluded that this problem happens due to the large number of folders and sub-folders in my drive. Each folder is a call to the API which makes the process very slow and inefficient.
Least but not last, any sub-folder request results in a “bad request”.

I hope this contribution helped to update the API’s FP client.

Thanks.

Mauricio Camargo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

 

TinyPortal © 2005-2018