Tag Info

Hot answers tagged

11

Good thing you didn't put a space in the name:


10

Just wanted to let everybody know that I just made a new release of the library here. This release includes tons of bug fixes as well as some breaking changes which shouldn't be a problem if you have been running off the trunk. Also, by popular demand, I added a .Net 3.5 version of the library to this release. The hope here is to eventually have a mono ...


8

You can get around the json/simplejson easily in your wrapper. Just change your import line from import urllib2, json, httplib, datetime, operator to import urllib2, httplib, datetime, operator try: import json except ImportError: import simplejson as json That way you can just use json in the rest of your code, but client pythons will load ...


6

I am using Py-StackExchange in our Stack2Blog application. How do I retrieve a list of answers of a specific user using this wrapper? After retrieving a user object, the .answers member variable returns an empty list while I know the user does have posts.


5

Usage Example: Stack Exchange Site Monitor JavaScript Site Monitor in 20 lines of code or less.... Demonstrates the use of Soapi.js to query stackauth.com to get an up-to-date list of Stack Exchange sites and then polling /stats for each one on a revolving timer. $(document).ready(function siteMonitor() { var apiKey = ''; new ...


4

The following is a quickly thrown together method that will return the accepted answer percentage of the user with the given ID. Note: This is using some code that will be available in the next release. Notice how it dramatically reduces complexity, and the length of code. public static double getAcceptedAnswerPercentage(StackWrapper sw, int userId) ...


4

Quite impressive - am looking forward for more! I'm afraid you'll need to change the library name soon though, as LINQToStackOverflow is at odds with the recently published Trademark Guidance, which explicitly asks for only one of the terms, "Stack" or "Exchange" or "Overflow" in your product name. So may I suggest the obvious: LINQ to Stack ;) Sounds ...


4

Search Examples Questions You can search for questions with StackWrap4J by instantiating a StackWrapper then calling the search method. Before calling search, you have to create a SearchQuery, which is a simple parameter object. StackWrapper so = new StackOverflow(); SearchQuery query = new SearchQuery(); query.setTags("swing"); ...


4

We (myself and Kyle), with graphical help from Nathan, developed an automatically generated image that pulls in the number of bounties, the total bounty rep value, and displays that in an image. It is part of the Ask Different Community Ads, and we're pretty proud of it. Thanks for developing Serel, it made the heavy lifting of StackExchange's API ...


3

Update 26-06-2010 PHPstack now works with SE API v0.9 and includes functions to retrieve data from StackAuth. Example of StackAuth sites function: <?php //assume $so is our PHPstack class $sites = $so->sites(); foreach($sites->body->api_sites as $site) { echo $site->name; } ?>


3

Mkay, I've only used the part of the code that relates to StackAuth: You forgot to update the version number for SitesMethod and UsersByIdAssociatedMethod SitesMethod and UsersByIdAssociatedMethod both take $key as a parameter, but seeing as we've already inited the stackPHP object with the key, seems a bit redundant. I changed my SitesMethod function to ...


3

Asynchronous Requests Async requests can be made using the Site's RouteFactory. A salient use case for this functionality is using Soapi in Silverlight. [TestMethod, Asynchronous] public void AnswersByIdTestValid() { // The thing to be aware of is that the IEnumerable, lazyloading // model is synchronous, and since we are on the UI thread here ...


3

This is a nice implementation, but it doesn't work on Java ME nor Android though. You seem to be experienced Java developer, because you are using the adapter pattern design and some introspection stuff. The main problem here is that Java ME and Android don't provide the java.beans package which is needed in order to use introspection as you are using it... ...


3

Soapi.CS Fluent Configuration var ctx = new ApiContext(ApiKey).Options // obviates a call to stackauth .SerializedSites("{ 'api_sites': [ {'name': 'Stack....") // can also be accomplished by seeding the cache .SeedCache(new RequestCacheItem { Uri = new Uri("http://stackauth.com/1.0/sites"), ResponseText = "{ ...


3

Edit: My problem below has been "solved", and it's a problem with the fact that I'm getting back gzip-compressed data from stackapps. See the SO Answer. I'm still unsure why this happens only on my computer (possible reason: routers in my network adding content-headers), but I'm guessing this should be fixed in the wrapper itself. Come to think of it, the ...


3

Proxy Example Sometimes you need to use a Proxy to access the internet. At my company we need to. StackWrap4J provides the ability to specify a Proxy server to rout connections through. Below is a short code sample that configures the proxy, and then pulls every answer that I (2598) have given. Proxy prox = new Proxy(Proxy.Type.HTTP, new ...


3

With the way the API is currently set up (lots of caching the info page says) is it possible to update the information on a question you've already looked at? I have a list of questions but, as time goes on, the information changes (# of answers, votes, etc) and I would like to be able to update the questions with the new info.


3

This currently does not work with the v2.0 API.


3

Example of Explicit Authentication: Explicit authentication is relatively straightforward with Stack.PY. Assuming you have already registered your application, the instructions look something like this: Visit your application's page to obtain the following information: key client ID client secret Provide Stack.PY with the above information: from ...


2

Soapi Caching and Throttling Throttle All API requests made by Soapi are routed first through Soapi.Net.RequestCache and failing a cache hit, they are then routed through Soapi.Net.RequestThrottle. The throttle, which is described in detail here, works on a sliding window, allowing maximum request rate up to the prescribed limits, currently 30 per 5 ...


2

Visual Studio JavaScript Intellisense and Code Completion Support Overview Included in the .zip is soapi-vsdoc.js. This file contains JavaScript code documented following the Visual Studio JavaScript Intellisense Documentation format. This file, while of special interest to users of Visual Studio, contains complete documentation of the API, including all ...


2

soapi.js vs soapi-vsdoc.js While the -vsdoc.js is quite large, it is never served. It is, if you are using Visual Studio, used to provide intellisense services, otherwise you may either delete it or keep it around as reference. The file that actually defines the domain types at runtime, soapi.js, is quite small, 9.5k packed, in that it only contains meta ...


2

Soapi.CS Full API Coverage // instantiate a context ApiContext ctx = new ApiContext("qgAq_KfDu0KYzlNG-qaTuw"); ctx.Initialize().AsyncWaitHandle.WaitOne(); // get a site Site sofu = ctx.Official.StackOverflow; // or Site stackapps = ctx.Sites.First(s=>s.ApiEndpoint == "http://api.stackapps.com"); --- // StackAuth Routes // /sites ...


2

OK, I'm probably missing the obvious, but how do I get the body of an answer? For example, in your code snippet: >>> so = stackexchange.Site('api.stackoverflow.com') >>> me = so.user(41981) >>> me.answers.fetch() >>> me.answers[0].body Traceback (most recent call last): File "<pyshell#45>", line 1, in ...


2

Bulk Data Import This is a simple example of using Soapi.CS for bulk data importation. This sample creates/updates a SQLite database with the the complete profile of all Stack Exchange users with reputation >= 100 and assigns a rank according to order of appearance. Soapi processes the ~1000 requests required in less than 5 minutes. You may run this ...


2

Building a simple app with Soapi.CS Suppose you would like to build a complete dataset containing all of your content and activity for all of your accounts on all Stack Exchange sites. You would need to: Get a list of your accounts from stackauth /users/{id}/associated For each account Get all of your questions Get all of your answers Get all of your ...


2

Soapi.CS Paged Results Pay particular attention to the third example; thats all 2800+ stack apps users in less than 5 seconds without breaking any rules. not too shabby. // Soapi elegantly handles multi-page requests. // Multi-paged requests are issued in parallel making data retrieval quick // get the default, 1 page of 30 using default sort var ...


2

Timeout Example If you find that a response is taking too long for your app, you can set a timeout on the request. If a timeout occurs, a java.net.SocketTimeoutException is thrown. The default timeout is 0 which means infinite, so you don't have to worry about the exception if you never set a timeout. StackWrapper sw = new StackOverflow(); // Set the ...


2

Request Caching In the interest of application performance and to prevent inadvertent api 'abuse', Soapi.js includes an integrated request cache that stores the results of each unique request url for a default (and minimum) period of 60 seconds. The caching duration may be increased for individual routes as per your application's needs. e.g. perhaps your ...


2

Throttled Request Queue To provide transparent compliance with the throttle limite, Soapi.js includes an integrated throttled request queue. The queue is integrated into the library and is transparent, requiring no additional coding or consideration. The current default queue interval is 170ms. This means that, with the request queue and request cache, ...



Only top voted, non community-wiki answers of a minimum length are eligible