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

Key not found in metadata when exporting with PyCAP #62

Closed
rrkell01 opened this issue Oct 21, 2015 · 21 comments
Closed

Key not found in metadata when exporting with PyCAP #62

rrkell01 opened this issue Oct 21, 2015 · 21 comments

Comments

@rrkell01
Copy link

I am exporting data from one of our REDCap servers. On the statement: p = Project(URL, API_KEY), I get a message "key not found in metadata". This is only happening on one server - it works on my other REDCap instances. I also used the PHP version of the API published by Vandy and it worked.

@sburns
Copy link
Collaborator

sburns commented Oct 21, 2015

Hi rrkell01, sorry about this issue. Since it only occurs for one server, this is most likely related to the version of REDCap on that server. You may be able to skirt the issue by using p = Project(URL, API_KEY, lazy=True) which defers loading the metadata about the project.

@rrkell01
Copy link
Author

Thanks for the quick reply. Lazy didn’t work either, got unexpected keyword argument. Also, my servers are all of the same version. We upgrade them at the same time. I will keep working on it. It must be something weird about the configuration of that one server. I appreciate your help.

Thanks,
Rob

From: Scott Burns [mailto:notifications@github.com]
Sent: Wednesday, October 21, 2015 11:51 AM
To: sburns/PyCap PyCap@noreply.github.com
Cc: rrkell01 rrkell01@louisville.edu
Subject: Re: [PyCap] Key not found in metadata when exporting with PyCAP (#62)

Hi rrkell01, sorry about this issue. Since it only occurs for one server, this is most likely related to the version of REDCap on that server. You may be able to skirt the issue by using p = Project(URL, API_KEY, lazy=True) which defers loading the metadata about the project.


Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sburns_PyCap_issues_62-23issuecomment-2D149940173&d=AwMCaQ&c=SgMrq23dbjbGX6e0ZsSHgEZX6A4IAf1SO3AJ2bNrHlk&r=3l06f4OvhWrlFDZOJS5wsa4MW9LCOmqmEVVIqGuPl5k&m=lZD7iuInc73OP9N9PrWVzQt-_P4xcm0Hlyzl3wG7ESg&s=Ak2pSAar32JSWisLJWMhqH6WEtshYzgjlyfEYdbQ-G0&e=.

@tjrivera
Copy link

tjrivera commented Jan 6, 2016

@rrkell01 If you're getting a message about an unexpected keyword argument its possible that you're using an older version of pycap. Try installing pycap from github (as opposed to PyPi) and it might solve your issue.

I also realize this issue is a bit old so you may have moved on.

@sburns
Copy link
Collaborator

sburns commented Jan 6, 2016

/me really needs to push a new version to pypi :(

@ASawyer12
Copy link

I am exporting data from one of my REDCap projects. On the statement: project = Project(URL, TOKEN), I get a message "Exporting metadata failed. Check your URL and token.". This is only happening within my server-side script running as a cgi file. When I run the script as filename.py in the interpreter, I receive no error. I am using cgi in the server-side script, and I've verified that it is not the issue. I've also tried using project = Project(URL, TOKEN, lazy=True). However, it does not mitigate the problem. Could this be a similar problem to @rrkell01?

@sburns
Copy link
Collaborator

sburns commented Apr 22, 2016

Did you hard-code the URL and TOKEN in your cgi script? Are you sure there isn't some firewall setting preventing the request from your server? It's just odd that it works in the interpreter (on your laptop or desktop I presume?) but not in the cgi script.

@cstasko
Copy link

cstasko commented Jan 16, 2019

I just started getting this error on the same statement in a python script that had been working previously. The lazy parameter does bypass this particular error, but instead I find that the project object that gets created seems empty despite clearly having data when viewed through the REDCap web app. All projects have the same problem. Any advice?

@sburns
Copy link
Collaborator

sburns commented Jan 16, 2019

Can you verify you're using the correct token? The lazy argument stops API calls when instantiating a Project and if the token is wrong, you'll see these errors I believe.

Assuming you haven't changed the installation of PyCap, it appears to not be a code change on pycap's part but perhaps how you're calling PyCap, ie w/ the wrong token?

@cstasko
Copy link

cstasko commented Jan 16, 2019

The script was working previously with the same tokens, and nothing changed on that front. I did just try copy/pasting again to be sure, and regenerating/replacing a new token, but no change in errors.

Thanks for the quick response!

@sburns
Copy link
Collaborator

sburns commented Jan 16, 2019

Are you aware of if your REDCap server has made any upgrades recently?

@cstasko
Copy link

cstasko commented Jan 16, 2019

Yes, I actually just heard back from the server admin who said they made security upgrades recently and that unless PyCap has an update, I probably have to find an alternative :(

@sburns
Copy link
Collaborator

sburns commented Jan 16, 2019

Assuming the API still works at this site, can you help me understand how the API has changed? I don't work with REDCap at all anymore so I'll need a little help digging into what's going on at this particular site.

@remifrazierucsf
Copy link

@cstasko Please try to find out what the REDCap version number is, whether it's a Standard or LTS release, and if the server admin can indicate if they've recently upgraded. There was a major LTS release that just came out which may have influenced your API calls.

@cstasko
Copy link

cstasko commented Jan 16, 2019

I believe it's version 8.5.24. Not sure about Standard/LTS; will find out. Thanks for the help -- I've got a fair amount riding on the ETL scripts I already wrote with PyCap.

@remifrazierucsf
Copy link

@cstasko what institution are you at?

@cstasko
Copy link

cstasko commented Jan 16, 2019

@remifrazierucsf Massachusetts General Hospital / Partners Health System

@remifrazierucsf
Copy link

@cstasko yeah you're on 8.5.24. I was somewhat hopeful that you happened to be on 8.5.23, which had a show-stopping API error. But the 8.5.24 release was the bugfix for that.

This seems most likely to be an issue the local admins should help you with. There hasn't been a foundational shift in how the API delivers data - there are some new things you can pull out -- but we haven't received any reports of backward compatibility issues from our rather large base of automators at UCSF. If your local admins made a change to break the API though that's a different thing.

Have you tried verifying a similar query is well-behaved in the API playground?

@cstasko
Copy link

cstasko commented Jan 16, 2019

@remifrazierucsf Nevermind, it seems like the issue was just that I didn't update the url for the new release. I'll test everything thoroughly tomorrow to confirm. Thanks for you help!

@remifrazierucsf
Copy link

remifrazierucsf commented Jan 16, 2019 via email

@sburns
Copy link
Collaborator

sburns commented Jan 17, 2019

Seems like we're all good then? For now at least :)

Thanks for the help -- I've got a fair amount riding on the ETL scripts I already wrote with PyCap.

@remifrazierucsf this makes my heart happy, glad you've found it helpful.

@cstasko
Copy link

cstasko commented Jan 17, 2019

Yeah, I learned that we have a a static URL I hadn't been using. After updating that parameter, all my testing looks good. Thanks again!

@sburns sburns closed this as completed Jan 17, 2019
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

6 participants