You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code works right now on tent.is but it's not exactly following the Tent spec.
The proper thing to do is:
First of all, all of these requests need to use this header:
Accept: application/vnd.tent.v0+json
Start with the entity URL, https://longears.tent.is
Do a HEAD request to get the HTTP Link headers which will point to the profile API address: https://longears.tent.is/tent/profile. If there are no Link headers, do a GET request and look in the HTML body for <link> tags. These URLs can be relative or absolute.
Use the profile API URLs to get the profile by doing a GET request. This is the GET /profile API method.
In the returned JSON, look up json['https://tent.io/types/info/core/v0.1.0']['servers'] which will be a list of API endpoints. In the case of tent.is, there will be only one and it will be https://longears.tent.is/tent unless the user changed it by updating their profile using the API
Also in the returned JSON, look up json['https://tent.io/types/info/core/v0.1.0']['entity'] and use that as the entity URL from now on. It might be different than the one you started with.
Notes on Link headers: python's requests library only gives us the last one when more than one is specified. We can fix that by parsing the Link header ourselves by grabbing it from r.headers['Link'] and splitting it into separate items. This would happen in TentApp.discoverAPIUrls().
The code works right now on tent.is but it's not exactly following the Tent spec.
The proper thing to do is:
https://longears.tent.is
Link
headers which will point to the profile API address:https://longears.tent.is/tent/profile
. If there are noLink
headers, do a GET request and look in the HTML body for<link>
tags. These URLs can be relative or absolute.GET /profile
API method.json['https://tent.io/types/info/core/v0.1.0']['servers']
which will be a list of API endpoints. In the case of tent.is, there will be only one and it will behttps://longears.tent.is/tent
unless the user changed it by updating their profile using the APIjson['https://tent.io/types/info/core/v0.1.0']['entity']
and use that as the entity URL from now on. It might be different than the one you started with.Notes on
Link
headers: python'srequests
library only gives us the last one when more than one is specified. We can fix that by parsing the Link header ourselves by grabbing it from r.headers['Link'] and splitting it into separate items. This would happen in TentApp.discoverAPIUrls().See https://tent.io/types/info/core/v0.1.0 for details of the HTTP
Link
headerSee https://tent.io/docs/app-server for an example JSON response to a
GET /profile
See tent/tent.io#72 for more discussion about this
Also, detection of tags in the HTML works but is not robust. We should use an HTML-parsing library to find the tags.
The text was updated successfully, but these errors were encountered: