Git Product home page Git Product logo

quickstatements3's Introduction

quickstatements3

Repository for the development of a new version of QuickStatements

Local development HOW TO

Required tools:

  • Docker
  • Make

To build the development container

> make build

To run a shell inside the container

> make shell

Make sure that you have an env file inside the local etc/ dir. This file contains all the ENVIRONMENT VARIABLES used by the system and must never be added to your git repo.

To generate a good secret key you can run with python 3.6+

python -c "import secrets; print(secrets.token_urlsafe())"

If you are running this container for the first time, you have to initialize the database and create a superuser for the Django ADMIN

> cd src
> python manage.py migrate
> python manage.py createsuperuser

Now that everything is set up, we can start Quickstatements. We have 2 ways of doing that:

  • from inside the container, running
>./cmd_run.sh
  • from our Makefile, running
> make run

Now Quickstatements is available at http://localhost:8765/

OAuth

This application uses OAuth2 with the Mediawiki provider.

The grants we probably need are

  • Perform high volume activity
    • High-volume (bot) access
  • Interact with pages
    • Edit existing pages
    • Edit protected pages (risk rating: vandalism)
    • Create, edit, and move pages

Consumer

After registering a consumer in

https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration

This application is listening on /auth/callback/, so, when registering, define the callback endpoint as https://yourdomain.com/auth/callback/.

After receveing the consumer id and secret, setup OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET environment variables.

Developer access

If you want to login with a developer access token, you need to register for yourself an owner-only consumer application for OAuth2. Follow the form and be sure to tick "This consumer is for use only by ".

Toolforge deployment

  • Login and enter into the tool user
  • Clone the repository at ~/www/python/
  • Update uwsgi.ini with the toolname. In this case, its qs-dev
  • Create the environment variables file at ~/www/python/src/.env with install -m 600 /dev/null ~/www/python/src/.env so that only your user can read it.
  • Run deploy.sh
  • Logs are at ~/uwsgi.log

quickstatements3's People

Contributors

arcstur avatar mgalves avatar dependabot[bot] avatar ederporto avatar

Stargazers

 avatar

Watchers

 avatar

quickstatements3's Issues

Implement CI

We could have a basic CI. I think I would like to have some static analysis and basic formatting.

Allow user to keep v1/csv preference

This is good if the user is submitting one batch after the other, so that they don't need to keep selecting csv time and time again if they prefer using csv.

Create custom exceptions and messages for API errors

For example, a custom error message saying the value is incorrect when we receive the following error response:

{'code': 'invalid-value', 'message': "Invalid value at '/statement/value/content'", 'context': {'path': '/statement/value/content'}}

Decide on proper selecting of wikibase URLs

The OAuth token we request is only valid for wikidata.org, and not test.wikidata.org for example. If the user wants to point to a different wikibase server, then the authentication should be different. As of know, wikibase url is selected as env var, and not as a dropdown/type when creating a new batch. Maybe we could allow users to select (1) wikidata, (2) test wikidata, or (3) custom server. Our OAuth token could allow editing on (1) and (2), and the user, when selecting (3), should provide its own direct token for us to use when authenticating.

QS API

Create API similar the one provided by QS2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.