ElsevierDev / elsapy

A Python module for use with Elsevier's APIs: Scopus, ScienceDirect, others.
http://api.elsevier.com
BSD 3-Clause "New" or "Revised" License
357 stars 141 forks source link

My API key does not work #61

Open AntonYuryev opened 3 years ago

AntonYuryev commented 3 years ago

I tried using integrationsupport@elsevier.com to establish communication with your team but no one has responded to me for already 2 weeks. My API key does not work. I guess I need a token from Elsevier. How can I get it?

uniformlyMatt commented 3 years ago

Fellow user here - not an employee or developer for Elsevier. I'm not sure what you've tried so far, but try the following:

Create a file called 'config.json' in the same directory as your code. The contents of 'config.json' are:

{
     "apikey": "<your api key>",
    "insttoken": ""
}

Then run the following:

import json
import requests

with open('config.json', 'r') as file:
    config = json.load(file)

apikey = config['apikey']
url = "http://api.elsevier.com/content/abstract/scopus_id/SCOPUS_ID:84881866621"

# Make a request for a given paper
resp = requests.get(url,
                    headers = {'Accept': 'application/json',
                               'X-ELS-APIKey': apikey,
                               'X-RateLimit-Reset': None})

# Check the status of the request
print(resp.headers['X-ELS-Status'])

# Check if the problem is the weekly download limit (usually 10000)
try:
    print(resp.header['X-RateLimit-Remaining'])
except:
    pass

I hope this helps!