r/evetech•
nuadi

Google Crest Script version 12a beta release

Good morning everyone.

I have finally made time to do a little work on GCS. This brings the version up to the 12 series (11 was skipped since it holds bulk data functions I was trying to get to work).

The 12a beta script is up in GitHub. You can always find the latest scripts there: https://github.com/nuadi/googlecrestscript

Changes

  1. Removed the getMarketItemList function. This function was a mistake. CCP has failed to recognize a need for a list-based endpoint for market orders, so I tried to work around it. However, Google's restrictions on custom functions and UrlFetchApp quotas has made this function more trouble than it's worth. So, I've purged it from this version, and all moving forward. If you insist on keeping it, then you can copy it out of a previous version. However, I will not support it after this version is final.
  2. Migrated getMarketJson to use ESI. This is not a public function, but it is the core of getOrders, getOrdersAdv, getStationMarketPrice, and getRegionMarketPrice. As such, this script is only in beta right now. If you would like to test it, you will find a MarketScript_12a_beta.gs file in the repository right now. Copy that script into a sheet and see how it goes. As always, let me know if you hit any errors.
  3. Removed retries. Previously, when a UrlFetchApp call failed, I would parse the error message to try and determine why. If it was a service error (e.g. 5xx error code), then the script would attempt to retry 3 times. This just leads to more UrlFetchApp calls. In addition, if all retries failed it would result in some functions returning 0 for a price - which is not informative as to the cause of the failure. Therefore, this has all been removed. From now on you will get the full error until I find a more elegant way to handle retries.

Again, this is a beta release. Look for the beta script named MarketScript_12a_beta.gs and copy it into a sheet as usual. I recommend making a copy of any production-class sheets to ensure proper function.

Functionality downgrade

Moving forward into ESI there are going to be functions that lose data or fail to provide information. Right now that is the name of stations for market orders. So, if you use getOrders or getOrdersAdv then you are going to have a rough time of it.

For some silly a really complex and gnarly reason, if a citadel ID is used in a market order then you have to authenticate with ESI in order to get just the name of said citadel. Why this public-private relationship even exists is beyond me the child of some really complex changes and competing ideas, but I brought it up to CCP ages ago and I see it's still lingering. As such, I'll try to find a simple way to auth with ESI in the future, but for now you are going to lose station Citadel names moving forward.

Additionally, the getMarketItems function has no future in ESI for some bewildering reason because they missed it. So, this function will continue to operate until CCP sunsets CREST in May migrates it to ESI. Hopefully they get their act together by then realize I was grumpy and give us a migration path for functions like this soon (tm).

Closing

As always, post issues in GitHub or message me here if you hit bugs. If I don't get any major complaints in the next few weeks then I will roll over the beta to production level and start work on something else if I can find time.

Now back to work.

o7
~nuadi

Edit 1: Changes based on discussion with CCP Bartender. Good talk. Appreciate the time.

Posted Aug 20, 2017, 1:51 PM UTC · edited

610
MartinTsv•

You need authentication because the api won't return results if the character used for authentication isn't on the access control list for that particular citadel.

3
nuadiOP•

Yep. I completely understand the system. I was the pilot that discovered market orders from citadels were leaking into the CREST output, and convinced CCP to keep them there. However, that was ages ago in CREST where there was a clean public-public relationship. Now, in ESI, it's changed to public-private and it makes app development very weird.

1
MartinTsv•

So if I'm understanding you correctly, you're advocating for public citadels (aka, ones with orders that show up in the bulk endpoints) to not require authentication?

1
nuadiOP•

Yes. After talking to CCP Bartender, it's not that simple right now but that's what devs like me need. In the meantime I will have to write an auth layer.

1
Blacksmoke16•

https://github.com/googlesamples/apps-script-oauth2

This can be altered to work with SSO/ESI. However the one caveat being can only auth one character at a time without more work.

Example being in how i implemented it in :

https://github.com/Blacksmoke16/GESI

2
CCP_Bartender•

Hey dude!

The whole team had a quick look at this just now, the short version is that some of it is not quite correct and some of it is a bit nuanced, but there's also some new info in here for us. We're especially keen to talk to you about what you mean by the "list-based endpoint for market orders", but reddit is not a great venue for these kinds of discussions. The tweetfleet slack is our preferred venue for this kind of discussion, and we're always available there during business hours. Could you jump on and ping myself or CCP Zoetrope when you've got a minute to talk about it?

3
nuadiOP•

I'll ping you guys soon. Just got out of a meeting, and I have a lot of cards to add to my dev board. So, once I'm done with that I'll pop into Slack.

2
Coalrage•

I would like to request a feature for GCS. Would it be possible to add a new function that will pull a character's orders? I think I saw the function already listed, "GET /characters/{character_id}/orders/"? I would like to be able to compare current orders versus a set of 'opportunities' to derive which are left open and need to be taken advantage of. This would be so awesome! I know I could (possibly) manage to pull the info mysef, but having a pre-built function to pull a character's orders would be so much easier to use, imo.

ps.. Also, would it be possible to add an additional filter to only display sell or buy orders? This would be icing on the cake!

2
nuadiOP•

Yes, all of that is possible.

Right now I am working on a Cache layer in the script since ESI gives us proper caching times. After that is done, then I can work on an authentication layer for the script which will directly support features like that.

Once an auth layer is built I will be able to integrate a majority of the ESI endpoints. The only ones that won't get built are those that exceed Google's limits for what ever reason.

1
Waynok•

Awesome stuff man.

I'm having a bit of an issue, and I believe it happened when I updated the script to the latest version, though it could have just coincided with it. I'm getting the url fetch error often, when I didn't used to get it at all really.

I just cleaned my sheet up considerably, so it should be fetching urls far less often now than ever before. So I'll keep an eye on it for the next few days and let you know. But have you heard of any such issue happening by chance?

1
nuadiOP•

There was a change to error handling with the latest version. Basically, I do not hide the errors anymore. Before, I would return a 0.00, now you see the errors.

This lets you use IFERROR functions now, and it helps me because now users can tell me what the errors are instead of just zeroes.

If you are hitting the UrlFetchApp quota often, consider that it is over your entire account not just one sheet. Do you run multiple sheets at once?

If this is the only one, let me know what function you're using and I'll look into it.

2
Waynok•

I run 1 sheet, but 2 copies of it. It's kind of a clunky sheet, so it's not too surprising that it's hitting this quota. If the sheet is closed, no one has it open in their browser, does it still pull data?

1
nuadiOP•

If it is closed then it doesn't update. I would have to look at your sheet to see how you're hitting 20,000 calls a day. Especially now that the script uses ESI and caches the data appropriately.

2