Comments (4)
Comment by havok2063
Saturday Oct 08, 2016 at 22:23 GMT
I have turned on the API authentication at Utah. And added some auth stuff into the Interaction class. By default, with no auth specified, requests will look for authentication credentials in a local .netrc file. So I didn't have to do much to implement this. I also added in the future option of changing the authentication to oauth.
I've also changed the request to use a Session instead. This will open and maintain a single request session so all requests use one tcp connection. I'm not sure if we want to do this since there's no way of dictating when to close the session. See
http://docs.python-requests.org/en/master/user/advanced/#request-and-response-objects
and
https://en.wikipedia.org/wiki/HTTP_persistent_connection
I've also added in optional session caching into the requests, using a new library called CacheControl. If Marvin can import this package it will use it, otherwise no. Go here
http://docs.python-requests.org/en/master/community/recommended/
and install / upgrade both CacheControl and Requests-Toolbelt
from marvin.
Comment by albireox
Sunday Oct 09, 2016 at 02:04 GMT
This looks good to me. I'm not sure about the single request session. I'll read the links, and let's talk about it next week on the call.
Does the interaction automatically prompts you for user and password if it cannot find them in the netrc file and, if introduced, saves them there?
from marvin.
Comment by havok2063
Tuesday Oct 11, 2016 at 15:58 GMT
Yeah, I'm not sure either about the request session. If we can figure out a nice way to close them after X time, then maybe it can help us. Otherwise, we can go back to ad hoc request calls, where each get and post is a separate tcp connection.
The Interaction raises a BrainAPIAuthError if the authentication fails and in the message tells you to create or check your credentials in your netrc file. With the way things are set up now, when a user tries to do something remotely without auth, it fails, a Warning gets generated when attempting to get the config.urlmap
for the first time but keeps going, then fails inside whatever code with a MarvinError, cannot make remote calls, no urlmap
.
from marvin.
This next step here is to do Oauth authentication, with Trac and API key. Closing this ticket and reopening a new one.
from marvin.
Related Issues (20)
- Spatially-Resolved Mass-Metallicity Relation exercise help HOT 3
- Trouble with "Constructing the Spatially-resolved Mass-Metallicity Relation" exercise HOT 1
- Link correction in GZ3D tutorial
- Marvin Error : Cube download DR17 HOT 2
- Import error: cannot import name 'escape' from 'jinja2' HOT 3
- Need help downloading emline maps HOT 3
- Error messages on jinja2, flask, json HOT 4
- packaging version > 22 breaks legacy version syntax HOT 6
- modelcube.stellarcont_fit raises an error HOT 1
- absmag_g_r column is incorrect
- json import error in itsdangerous package
- cannot import name 'safe_str_cmp' from 'werkzeug.security' HOT 2
- Integrated spectra of MaNGA galaxies HOT 2
- cannot import name 'escape' from 'jinja2' HOT 9
- package confliction
- Marvin Web No Longer Displaying Maps HOT 5
- Marvin not opening maps after pip install update HOT 1
- Internal Server error HOT 2
- cannot access maps HOT 6
- Cannot Query Full List of Parameters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marvin.