gdcc / pyDataverse

Python module for Dataverse Software (dataverse.org).
http://pydataverse.readthedocs.io/
MIT License
63 stars 41 forks source link

fix(sword-api): get_service_document throws error due to auth-failure #163

Open jmurugan-fzj opened 7 months ago

jmurugan-fzj commented 7 months ago

Describe your environment

Follow best practices

Describe the PR

Testing

Commits

Others

Documentation contribution

Code contribution

Closes #162

pdurbin commented 7 months ago

@jmurugan-fzj thanks for the pull request!

I wish we had some CI set up to test pyDataverse regularly. That way we could include in pull requests like this some tests asserting that the service document can be retrieved. Would you be interested in helping with this effort? We're spinning up Dataverse in GitHub Actions over at https://github.com/gdcc/api-test-runner and plan to someday create a proper GitHub Action: https://github.com/gdcc/dataverse-action

I just opened this related issue:

jmurugan-fzj commented 7 months ago

@jmurugan-fzj thanks for the pull request!

I wish we had some CI set up to test pyDataverse regularly. That way we could include in pull requests like this some tests asserting that the service document can be retrieved. Would you be interested in helping with this effort? We're spinning up Dataverse in GitHub Actions over at https://github.com/gdcc/api-test-runner and plan to someday create a proper GitHub Action: https://github.com/gdcc/dataverse-action

I just opened this related issue:

@pdurbin yes sure, I can also support but may not be able to guarantee the priority for this task presently with my work related engagements, may be we could discuss further your expectations regarding my contributions?

pdurbin commented 7 months ago

Yes, it would be great to talk. Maybe next week? I'm hoping to know more about the pyDataverse situation on Monday.

jmurugan-fzj commented 7 months ago

Yes, it would be great to talk. Maybe next week? I'm hoping to know more about the pyDataverse situation on Monday.

@pdurbin Sure, could you please send me an invite for next week? I am available most days after Monday and my time zone is GMT+1

pdurbin commented 7 months ago

@jmurugan-fzj are you on Zulip? @JR-1991 and I talk in #python there. We just advertised this in the README:

You're very welcome to join us! Maybe there we could figure out a meeting time.

jmurugan-fzj commented 7 months ago

@jmurugan-fzj are you on Zulip? @JR-1991 and I talk in #python there. We just advertised this in the README:

You're very welcome to join us! Maybe there we could figure out a meeting time.

@pdurbin Thanks, I joined and messaged you there, let me know your availability!

JR-1991 commented 7 months ago

@jmurugan-fzj thanks for the submission! I tested your PR to POST data to Demo Dataverse (using native PyDataverse and EasyDataverse). Everything works fine! Please find the code I have used in the following:

from easyDataverse import Dataverse

# Connect to a Dataverse installation
dataverse = Dataverse(
  server_url="https://demo.dataverse.org",
  api_token="...",
)

# Intiialize a dataset
dataset = dataverse.create_dataset()

# Fill metadata blocks
dataset.citation.title = "My dataset"
dataset.citation.subject = ["Other"]
dataset.citation.add_author(name="John Doe")
dataset.citation.add_dataset_contact(name="John Doe", email="john@doe.com")
dataset.citation.add_ds_description(value="This is a description of the dataset")

dataset.upload("ed_test")

response = dataverse.native_api.create_dataset(
    "ed_test",
    dataset.dataverse_json(),
)

print(response.text)

Out

Connecting to https://demo.dataverse.org/
Connection successfuly established!

- Using EasyDataverse

Dataset with pid 'doi:10.70122/FK2/P94QEH' created.
https://demo.dataverse.org/dataset.xhtml?persistentId=doi:10.70122/FK2/P94QEH

- Using native API

Dataset with pid 'doi:10.70122/FK2/PPMKBO' created.
'{"status":"OK","data":{"id":2110496,"persistentId":"doi:10.70122/FK2/PPMKBO"}}'

image

sonarcloud[bot] commented 7 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication