Git Product home page Git Product logo

graphdb-python-api's Issues

How to use the api with authentication?

Hi all,

My graphdb server uses authentication, but I am not sure how to use it.
My example is:

import graphdb.graphdb_workbench
from graphdb.graphdb_workbench.rest import ApiException
from pprint import pprint

from graphdb.graphdb_workbench.configuration import Configuration
from graphdb.graphdb_workbench.api_client import ApiClient

configuration = Configuration()
configuration.host = "https://graph.vast-project.eu"
# Username for HTTP basic authentication
configuration.username = "username"
# Password for HTTP basic authentication
configuration.password = "password"
configuration.debug = True
api = ApiClient(configuration=configuration)

# create an instance of the API class
api_instance = graphdb.graphdb_workbench.ImportControllerApi(api)
import_body = graphdb.graphdb_workbench.ServerImportBody() # ServerImportBody | importBody
repository_id = 'VAST-Test' # str | repositoryID

try:
    # Get server files available for import
    api_response = api_instance.list_server_files_using_get(repository_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ImportControllerApi->list_server_files_using_get: %s\n" % e)

The result I get is:

Exception when calling ImportControllerApi->list_server_files_using_get: (401)
Reason: 
HTTP response headers: HTTPHeaderDict({'Date': 'Mon, 29 May 2023 16:32:32 GMT', 'Server': 'GraphDB/10.1.4 RDF4J/4.2.2', 'WWW-Authenticate': 'Basic realm="GraphDB REST API endpoint", GDB', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-XSS-Protection': '1; mode=block', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Content-Type': 'text/plain;charset=UTF-8', 'Content-Length': '31'})
HTTP response body: Unauthorized (HTTP status 401)

URL are outdated...

Hi all,

I am trying to use list_server_files_using_get(), and it calls a wrong url (/rest/data/import/server/) instead of the correct one (/rest/repositories//import/server).

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.