Opened 3 years ago

Closed 14 months ago

#4954 closed change (fixed)

A downloader script supporting OAuth2 authentication/authorization

Reported by: kvas Assignee: atudor
Priority: Unknown Milestone:
Module: Sitescripts Keywords:
Cc: atudor Blocked By:
Blocking: #2492 Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29833582/

Description (last modified by atudor)

Background

In order to implement the automation described in #2492 we need a script that can download files using OAuth2 authentication. This ticket provides specification for such a script.

Reference materials:

What to change

We need a script that can use a service account credentials file to authenticate with an OAuth2 provider, authorize itself for a scope that would allow downloading the requested URL, download the file and output it to stdout.

The script should be placed in 'sitescripts/oauth2dl/bin/oauth2dl.py and invoked as follows:

python -m sitescripts.oauth2dl.bin.oauth2dl [-k <key-file>] [-s <scope>] [-o <path>] <url>

Invocation via python .../oauth2dl.py ... should also be possible. The options can be replaced by environment variables OAUTH2DL_KEY and OAUTH2DL_SCOPE. Options have precedence over the environment variables and each parameter (key file and scope) must be specified in some way.

When the script is invoked correctly, it should output the downloaded data to stdout or write it to the file provided through the -o optional variable. In case of error the error code should be set and the error message printed to stderr.

Tests should be written as well, mocking the server using wsgi_intercept. A successful scenario should be tested as well as the main failure modes.

Change History (6)

comment:1 Changed 3 years ago by kvas

  • Description modified (diff)
  • Sensitive unset

comment:2 Changed 14 months ago by atudor

  • Cc atudor added
  • Owner set to atudor

comment:3 Changed 14 months ago by atudor

  • Description modified (diff)

comment:4 Changed 14 months ago by atudor

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:6 Changed 14 months ago by atudor

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.