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

Network request failed error #119

Open
seif1000 opened this issue May 21, 2023 · 4 comments
Open

Network request failed error #119

seif1000 opened this issue May 21, 2023 · 4 comments

Comments

@seif1000
Copy link

seif1000 commented May 21, 2023

I am using wikibase-sdk package in React Native , I always get this error

 Network request failed
const wbk = WBK({
  instance: 'https://my-wikibase-instan.se',
  sparqlEndpoint: 'https://query.wikidata.org/sparql',
});
useEffect(()={
 const url = wbk.getEntities({
          ids: ['Q25387195'],
          languages: ['ar'],
        });
        console.log('====================================');
        console.log(url);
        console.log('====================================');
        // const url = wbk.getEntities({
        //   ids: ['Q1', 'Q5', 'Q571'],
        //   languages: ['en', 'fr', 'de'], // returns all languages if not specified
        //   props: ['info', 'claims'], // returns all props if not specified
        //   format: 'xml', // default: json
        // });
},[])
@EdJoPaTo
Copy link
Contributor

you probably want to set the instance argument to the actual instance? or did you change it here to some dummy value?

When interested in wikidata you need to import wdk:

import wdk from 'wikibase-sdk/wikidata.org'

@colo21000
Copy link

colo21000 commented May 22, 2023

Hi @EdJoPaTo
I did not get you
I used it as it is above, I don't exactly know what are the requirements of using this package.
should I generate my custom instance?

and when I used import wdk from 'wikibase-sdk/wikidata.org'
I got Unable to resolve module Error

@EdJoPaTo
Copy link
Contributor

The idea of wikibase-sdk is to connect to an existing Wikibase instance. For example Wikidata is one Wikibase instance. (You can of course host your own Wikibase instance but thats probably not what you want to do.)

You configure which instance you want to connect with or just use the preconfigured wdk one which I mentioned in my last message which is already defined for Wikidata.

Also notice that this library does nothing with the network by itself. Network errors would be from some other source. Also the not working import is probably related to your setup? are you sure you are using wikibase-sdk v9? Earlier versions did not hat the wikidata.org export available so that might be a reason why thats not working

@colo21000
Copy link

yes I am using 9.1.2 v
do you think this is because I am using typescript?

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

No branches or pull requests

3 participants