Home   Archive   Permalink



Update on Etsy Authentication; Rebol 2 Scripts

I've been in the process of migrating my Rebol 2 scripts to a new repository:
    
https://github.com/rgchris/Scripts-For-Rebol-2
    
This should now be considered the canonical location for these scripts—I do plan on syncing with my site http://reb4.me though this may take a little time.
    
In addition to this move, I've written a new script to obtain authentication credentials from Etsy (authentication in my Etsy script was broken by a change to their API). You will still need to plug in your application key before running the script (for now). cURL is a requirement (try: `call/wait ['curl' '-h']` to see if cURL is installed on your system).
    
This script is built on atop a new HTTPd scheme that should, I hope, make writing little web servers for this type of operation much easier (see the `authenticate-etsy.r` script for example usage). It's still a bit rough around the edges and could certainly use a few more features, but should by and large work.
    
Please let me know of any problems, or indeed any successes.

posted by:   Chris       6-Feb-2017/12:04:54-8:00



call/wait ["curl" "-h"]
    
For checking on cURL.

posted by:   Chris       6-Feb-2017/12:05:56-8:00



Thanks Chris, I want to go through this, as soon as I get some extra time...

posted by:   Nick       6-Feb-2017/12:54:17-8:00



Using the HTTPd scheme itself is fairly straightforward:
    
do %httpd.r
open/custom httpd://:8080 [
     ; you have access here to two objects: REQUEST and RESPONSE
     ; you can set the response by altering the fields in the RESPONSE object
     ; by default, the server returns 404
    
     if request/action = "GET /test" [
         response/status: 200
         response/content: "You've passed the test!"
     ]
    
     ; setting RESPONSE/KILL? to TRUE will break the WAIT loop below
]
    
wait [] ; can also e.g. WAIT 60 to only wait for a minute
    


posted by:   Chris       6-Feb-2017/17:07:02-8:00



Updated the Etsy Authenticator to 0.2.0. It now requests your application credentials first, so no need to edit the script before running (unless you need to change the scope--next version!!).

posted by:   Chris       12-Feb-2017/3:19:42-8:00



Can the Etsy script be converted to Red? Anything not available in Red to prevent this?
    


posted by:   Danie       28-Feb-2017/8:48:42-8:00



Rock and roll Chis. Thank you.

posted by:   Nick       28-Feb-2017/10:41:26-8:00



Danie--don't know enough about Red's HTTP(S) capabilities to say for certain. At minimum you need to be able to generate and include the OAuth 'Authentication' header with each request.
    
As to this particular approach for procuring the necessary user keys, I'm not sure if Red is yet capable of running a web server.

posted by:   Chris       3-Mar-2017/13:30:18-8:00