Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli options #185

Merged
merged 7 commits into from
Jan 12, 2022
Merged

Add cli options #185

merged 7 commits into from
Jan 12, 2022

Conversation

eggplants
Copy link
Contributor

@eggplants eggplants commented Jan 10, 2022

I have added options to specify request method (-m, --method) and HTTPS auth (-a, --auth, -u, --username, -p, --password) and some testcases.

$ rqw -h
usage: rqw [-h] (-f FILE | -Q QUERY) [-F FORMAT] [-e URI] [-m METHOD] [-a AUTH] [-u ID] [-p PW] [-q] [-V]

sparqlwrapper CLI

optional arguments:
  -h, --help                  show this help message and exit
  -f FILE, --file FILE        query with sparql file (stdin: -) (default: None)
  -Q QUERY, --query QUERY     query with string (default: None)
  -F FORMAT, --format FORMAT  response format (default: json)
  -e URI, --endpoint URI      sparql endpoint (default: http://dbpedia.org/sparql)
  -m METHOD, --method METHOD  request method (default: None)
  -a AUTH, --auth AUTH        HTTP auth (default: None)
  -u ID, --username ID        username for auth (default: guest)
  -p PW, --password PW        password for auth (default: )
  -q, --quiet                 supress warnings (default: False)
  -V, --version               show program's version number and exit

allowed FORMAT:
  - json
  - xml
  - turtle
  - n3
  - rdf
  - rdf+xml
  - csv
  - tsv
  - json-ld

allowed METHOD:
  - POST
  - GET

allowed AUTH:
  - BASIC
  - DIGEST

$ rqw -e https://lindas.admin.ch/query -Q "SELECT DISTINCT ?x WHERE { ?x ?y ?z . } LIMIT 1" -m POST
x
http://classifications.data.admin.ch/canton/bl

SPARQLWrapper/main.py Outdated Show resolved Hide resolved
SPARQLWrapper/main.py Outdated Show resolved Hide resolved
Copy link
Member

@aucampia aucampia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change and tests looks good and I think it is fairly safe as by default if no new flags are used the behaviour is as it was before.

@nicholascar nicholascar self-requested a review January 12, 2022 21:10
@nicholascar nicholascar merged commit baf9b17 into RDFLib:master Jan 12, 2022
@eggplants eggplants deleted the cli_method branch January 12, 2022 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants