[fpc-pascal] OAuthv1/Twitter library/application ready; was: EncodeURLElement, underscore and RFC3986?

Reinier Olislagers reinierolislagers at gmail.com
Thu Jun 21 15:33:31 CEST 2012

(Cross-posted to Synapse and FPC mailing lists)

>> On 11-6-2012 16:38, Lukas Gebauer wrote:
>>> BTW: OAuth library will be interesting, feel free to inform here 
>>> about it.

I've finished a basic Twitter application and OAuth v1 library under an
MIT license (happy to relicense under the Synapse license).

Code can be downloaded using Mercurial or as a zip from

While not perfect yet, the application demonstrates:
- Authenticating to Twitter using existing credentials (ConsumerKey,
ConsumerSecret, Auth_token, Auth_secret)
- Authenticating to Twitter using Out Of Band/PIN authentication using a
callback in the application that sends the user to an URL. User
authorizes application and gets a PIN which he enters in the application.
- Reading public and own timeline
- Parsing tweets from JSON data
- Tweeting a message
- Showing all tweets that come through the streaming API

Currently only run on Windows; it will be probably need some tweaks for
line ending issues on Linux/OSX.
Built for FPC (on 2.6.1); don't know how hard it would be to port this
to Delphi.

Comments and improvements to the code are always welcome - I'm not a
programming guru, but got this done with some help... ;)

To implement streaming support (Twitter sends a stream of tweets inside
a single HTTP response), I had to modify Synapse httpsend to be able to
override ReadUnknown (see patch). I'd be very happy if that patch could
be applied.
Added as Feature Request 3536896 [Patch] Allow httpsend.Readunknown
override in SourceForge with the same patch as attachment.

-------------- next part --------------
Index: httpsend.pas
--- httpsend.pas	(revision 160)
+++ httpsend.pas	(working copy)
@@ -106,7 +106,7 @@
     FRangeStart: integer;
     FRangeEnd: integer;
     FAddPortNumberToHost: Boolean;
-    function ReadUnknown: Boolean;
+    function ReadUnknown: Boolean; virtual;
     function ReadIdentity(Size: Integer): Boolean;
     function ReadChunked: Boolean;
     procedure ParseCookies;

More information about the fpc-pascal mailing list