Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Cannot save a session #34

Open
brownmk opened this issue Sep 4, 2015 · 1 comment
Open

Cannot save a session #34

brownmk opened this issue Sep 4, 2015 · 1 comment

Comments

@brownmk
Copy link

brownmk commented Sep 4, 2015

Hi, I implement SessionClient.save() method as below

def save(self, file_name=None):
    print file_name
    r=requests.post(self.__url, data=json.dumps({'file': file_name}), headers={'Content-Type': 'application/json'})
    print r.content

But it does not seem to work, looks like Cytoscape does not pick up the file name parameter. Do you have any suggestions? I check the cyREST source code, it simply reads the "file" parameter, looks fine there. Thanks a lot for your helps!
=== Output from the method ===
c:\Temp\test.cys
{"cause":{"cause":null,"stackTrace":[{"methodName":"","fileName":null,"lineNumber":-1,"className":"java.io.File","nativeMethod":f
alse},{"methodName":"createSessionFile","fileName":"SessionResource.java","lineNumber":143,"className":"org.cytoscape.rest.internal.res

@brownmk
Copy link
Author

brownmk commented Sep 24, 2015

Okay, I believe this is related to a problem with cyREST implementation.
In SessionResource.java, line 140
It reads the file name using QueryParam("file"). This probably is not right and should ideally be fixed.

As the result, the symptom is:
The following works, as file parameter is part of the URL:
requests.post("http://localhost:1234/v1/session?file=c:/Temp/t2.cys")
The following fails, b/c file parameter is sent in the body
requests.get("http://localhost:1234/v1/session", data=json.dumps({'file':'c:/Temp/t2.cys'}))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant