Git Product home page Git Product logo

twitter-conduit's Introduction

twitter-conduit: An Conduit based Twitter API library for Haskell

CI Hackage Hackage-Deps

About

This is an conduit based Twitter API library for Haskell, including Streaming API supports.

Documentation is available in hackage.

Quick Start

For a runnable example, see sample/simple.hs. You can find other various examples in sample directory.

Run Samples

Build

Building with Cabal

$ cabal v2-build all

Building with Stack

To build with Stack, you should create top-level stack.yaml file first. An example of stack.yaml is like below:

resolver: lts-18.12
packages:
- .
- sample
extra-deps:
- twitter-types-0.11.0
- twitter-types-lens-0.11.0

then, run stack.

$ stack build

Run

First, you must obtain consumer key and secret from Twitter Application Management page, and you have to set those values to environment variables as shown below:

$ export OAUTH_CONSUMER_KEY="YOUR APPLICATION CONSUMER KEY"
$ export OAUTH_CONSUMER_SECRET="YOUR APPLICATION CONSUMER SECRET"

Before you run examples, you must prepare OAuth access token and secret. You can obtain access token and secret by using either PIN or web callback.

If you would like to use the PIN method, you run simply as below, and follow instructions:

$ cabal run oauth_pin

On the other hand, If you would like to use the callback method, do as follows:

$ cabal run oauth_callback

and open http://localhost:3000/signIn in your browser.

In both cases, you can obtain OAUTH_ACCESS_TOKEN and OAUTH_ACCESS_SECRET variables, then you should set those values to environment variables as shown below:

$ export OAUTH_ACCESS_TOKEN="YOUR ACCESS TOKEN"
$ export OAUTH_ACCESS_SECRET="YOUR ACCESS SECRET"

Finally, you can access Twitter UserStream as follows:

$ cabal run userstream

Examples

TODO

Authors and Credits

twitter-conduit initially was written by Takahiro Himura. We would like to thank everyone who supported and contributed to the development of this library.

twitter-conduit's People

Contributors

bitemyapp avatar bjing avatar cdepillabout avatar cdupont avatar chiro avatar dato avatar dougburke avatar dzhus avatar eagletmt avatar elldritch avatar himura avatar hrls avatar javran avatar kini avatar mhova avatar minamiyama1994 avatar mwotton avatar ocharles avatar psibi avatar rufflewind avatar s9gf4ult avatar seagull-kamome avatar seanhess avatar sid-kap avatar sullyj3 avatar tanakh avatar timjb avatar tokiwoousaka avatar xhlkogitsune avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitter-conduit's Issues

Sample does not work

I am trying to run code inspired by https://github.com/himura/twitter-conduit/blob/master/sample/simple.hs and indeed I get to enter the PIN and it fetches the credentials, but then all requests fail with Twitter telling me I am not authenticated (TwitterErrorMessage {twitterErrorCode = 32, twitterErrorMessage = "Could not authenticate you."}).

Sorry for not giving a more helpful bug report… does this work for others or is the sample out of date somehow?

Worng number of favourites when using showId on a retweet

I'm using this code:

twit <- withManager $ \mgr -> call twInfo mgr $ showId (read (head ids))

to get the info on a tweet and this:

twit ^. statusFavoriteCount

to get the total of favourites.

It works great with original twits. But with retweets, I always get 0 favourites, no matter how many it has.
Couldn't find a way to solve this.

Missing search "result_type" parameter

From the twitter search API docs:

Specifies what type of search results you would prefer to receive. The current default is "mixed." Valid values include:
mixed : Include both popular and real time results in the response.
recent : return only the most recent results in the response
popular : return only the most popular results in the response.

Troubles installing twitter-conduit

I'm having troubles installing twitter-conduit.
Running cabal install twitter-enumerator yields:

Resolving dependencies...
In order, the following will be installed:
certificate-1.0.1 (latest: 1.3.8) (new version)
cprng-aes-0.2.5 (latest: 0.5.2) -fastaes (reinstall) changes: cipher-aes-0.1.8
removed, cryptocipher-0.6.1 added
tls-0.8.5 (latest: 1.1.5) (new version)
tls-extra-0.4.2.1 (latest: 0.6.5) (new version)
http-enumerator-0.7.2.5 (latest: 0.7.3.3) (new package)
authenticate-0.10.4 (latest: 1.3.2.6) (new package)
twitter-enumerator-0.0.3 (new package)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring certificate-1.0.1...
Building certificate-1.0.1...
Preprocessing library certificate-1.0.1...
[1 of 9] Compiling Data.Certificate.KeyRSA ( Data/Certificate/KeyRSA.hs, dist/build/Data/Certificate/KeyRSA.o )

Data/Certificate/KeyRSA.hs:29:27:
    Constructor `RSA.PrivateKey' does not have field `RSA.private_size'
    In the expression:
      RSA.PrivateKey
        {RSA.private_size = calculate_modulus p_modulus 1,
         RSA.private_n = p_modulus, RSA.private_d = priv_exp,
         RSA.private_p = p_p1, RSA.private_q = p_p2,
         RSA.private_dP = p_exp1, RSA.private_dQ = p_exp2,
         RSA.private_qinv = p_coef}
    In an equation for `privkey':
        privkey
          = RSA.PrivateKey
              {RSA.private_size = calculate_modulus p_modulus 1,
               RSA.private_n = p_modulus, RSA.private_d = priv_exp,
               RSA.private_p = p_p1, RSA.private_q = p_p2,
               RSA.private_dP = p_exp1, RSA.private_dQ = p_exp2,
               RSA.private_qinv = p_coef}
    In an equation for `parsePrivate':
        parsePrivate
          [Start Sequence,
           IntVal 0,
           IntVal p_modulus,
           IntVal pub_exp,
           IntVal priv_exp,
           IntVal p_p1,
           IntVal p_p2,
           IntVal p_exp1,
           IntVal p_exp2,
           IntVal p_coef,
           End Sequence]
          = Right (pubkey, privkey)
          where
              privkey
                = RSA.PrivateKey
                    {RSA.private_size = calculate_modulus p_modulus 1,
                     RSA.private_n = p_modulus, RSA.private_d = priv_exp,
                     RSA.private_p = p_p1, RSA.private_q = p_p2,
                     RSA.private_dP = p_exp1, RSA.private_dQ = p_exp2,
                     RSA.private_qinv = p_coef}
              pubkey
                = RSA.PublicKey
                    {RSA.public_size = calculate_modulus p_modulus 1,
                     RSA.public_n = p_modulus, RSA.public_e = pub_exp}
              calculate_modulus n i
                = if (2 ^ (i * 8)) > n then i else calculate_modulus n (i + 1)

Data/Certificate/KeyRSA.hs:29:27:
    Constructor `RSA.PrivateKey' does not have field `RSA.private_n'
    In the expression:
      RSA.PrivateKey
        {RSA.private_size = calculate_modulus p_modulus 1,
         RSA.private_n = p_modulus, RSA.private_d = priv_exp,
         RSA.private_p = p_p1, RSA.private_q = p_p2,
         RSA.private_dP = p_exp1, RSA.private_dQ = p_exp2,
         RSA.private_qinv = p_coef}
    In an equation for `privkey':
        privkey
          = RSA.PrivateKey
              {RSA.private_size = calculate_modulus p_modulus 1,
               RSA.private_n = p_modulus, RSA.private_d = priv_exp,
               RSA.private_p = p_p1, RSA.private_q = p_p2,
               RSA.private_dP = p_exp1, RSA.private_dQ = p_exp2,
               RSA.private_qinv = p_coef}
    In an equation for `parsePrivate':
        parsePrivate
          [Start Sequence,
           IntVal 0,
           IntVal p_modulus,
           IntVal pub_exp,
           IntVal priv_exp,
           IntVal p_p1,
           IntVal p_p2,
           IntVal p_exp1,
           IntVal p_exp2,
           IntVal p_coef,
           End Sequence]
          = Right (pubkey, privkey)
          where
              privkey
                = RSA.PrivateKey
                    {RSA.private_size = calculate_modulus p_modulus 1,
                     RSA.private_n = p_modulus, RSA.private_d = priv_exp,
                     RSA.private_p = p_p1, RSA.private_q = p_p2,
                     RSA.private_dP = p_exp1, RSA.private_dQ = p_exp2,
                     RSA.private_qinv = p_coef}
              pubkey
                = RSA.PublicKey
                    {RSA.public_size = calculate_modulus p_modulus 1,
                     RSA.public_n = p_modulus, RSA.public_e = pub_exp}
              calculate_modulus n i
                = if (2 ^ (i * 8)) > n then i else calculate_modulus n (i + 1)
Failed to install certificate-1.0.1
Configuring cprng-aes-0.2.5...
Building cprng-aes-0.2.5...
Preprocessing library cprng-aes-0.2.5...
[1 of 1] Compiling Crypto.Random.AESCtr ( Crypto/Random/AESCtr.hs, dist/build/Crypto/Random/AESCtr.o )

Crypto/Random/AESCtr.hs:31:1:
    Failed to load interface for `Crypto.Cipher.AES'
    It is a member of the hidden package `cipher-aes-0.2.5'.
    Perhaps you need to add `cipher-aes' to the build-depends in your .cabal file.
    It is a member of the hidden package `cipher-aes-0.1.8'.
    Perhaps you need to add `cipher-aes' to the build-depends in your .cabal file.
Failed to install cprng-aes-0.2.5
cabal: Error: some packages failed to install:
authenticate-0.10.4 depends on cprng-aes-0.2.5 which failed to install.
certificate-1.0.1 failed during the building phase. The exception was:
ExitFailure 1
cprng-aes-0.2.5 failed during the building phase. The exception was:
ExitFailure 1
http-enumerator-0.7.2.5 depends on cprng-aes-0.2.5 which failed to install.
tls-0.8.5 depends on certificate-1.0.1 which failed to install.
tls-extra-0.4.2.1 depends on certificate-1.0.1 which failed to install.
twitter-enumerator-0.0.3 depends on cprng-aes-0.2.5 which failed to install.

How can I install twitter-conduit correctly?

Upper bound on lens should be relaxed

The upper bound on lens is too strict, which prevents it from compiling with GHC 7.10. Currently using it with lens-4.9 and it seems to work fine.

Compiler error on compiling samples from sandbox

I get a sequence of compiler errors when trying to build this project from a fresh cabal sandbox.

First, the samples are missing a dependency on scotty. Running cabal install scotty fixes this.

Then, the compiler throws two "not in scope" errors from userstream.hs for ^! and act.

[Question] Caching or memoization when possible.

Is it possible to somehow cache the value returned from an API call? Top-level bindings do not (seem) to accomplish this. For example (withCF is a function borrowed from the samples somewhere) :

memoUser = withCF $ usersShow (ScreenNameParam "someLuser")

Now if you try to apply accessor functions, like userName or userFollowers, those calls cause memoUser to be re-evaluated. Obviously, since there are impure actions going on behind the scenes, memoUser is not technically referentially-transparent, but in certain cases, such as this, replacing memoUser by the value returned by the right-hand-side would be acceptable, and would prevent many applications of other functions from counting against the API limits.

Is there a way to express this with twitter-conduit as is?

`searchTweets` is broken

If I try to run a command like:

runSearch (login :: TWInfo) = 
  withManager $ \mgr -> call' login mgr (searchTweets "search term")

I get an error: `FromJSONError "when expecting a (), encountered Object instead".

Relatedly, (APIRequest SearchTweets a) is an instance of HasMaxIdParam but searchTweets does not have the right signature to be used with sourceWithMaxId, as the return type of searchTweets is not a list, as required by sourceWithMaxId. This isn't a bug persay, but is very annoying.

Also, I can't run the search.hs sample.

Hlint style failure

> /tmp/stackage-build13/twitter-conduit-0.2.2$ dist/build/hlint/hlint
Web/Twitter/Conduit/Parameters/TH.hs:6:1: Warning: Use module export list
Found:
  module Web.Twitter.Conduit.Parameters.TH where
Why not:
  module Web.Twitter.Conduit.Parameters.TH
         (module Web.Twitter.Conduit.Parameters.TH) where
Note: An explicit list is usually better

1 hint

Deprecated inReplyToStatusId

Hi,

I'm adding twitter support to my mastodon IRC bot, and after struggling a bit to install the lib (apparently debian's version of cabal can't install some of twitter-conduit's dependencies) I got all of that to work.
Now trying to follow the doc (http://hackage.haskell.org/package/twitter-conduit-0.2.2/docs/Web-Twitter-Conduit.html) to implement a reply function :

st <- Twitter.call twinfo mgr $ Twitter.update (T.pack repl) & Twitter.inReplyToStatusId ?~ id'

I get "Deprecated: "Please use Web.Twitter.Conduit.Parameters.inReplyToStatusId"".
Would be nice to update the doc if possible, 'cause I have absolutely no idea how to do that :)

[PATCH] Add friendsList function

index afde2b2..9ed7afe 100644
--- a/Web/Twitter/Conduit/Fetch.hs
+++ b/Web/Twitter/Conduit/Fetch.hs
@@ -20,6 +20,7 @@ module Web.Twitter.Conduit.Fetch
        -- * Friends & Followers
        , friendsIds
        , followersIds
+       , friendsList
        -- , friendshipsExists
        -- , friendshipsIncoming
        -- , friendshipsOutgoing
@@ -119,6 +120,10 @@ friendsIds, followersIds
 friendsIds   q = apiCursor "friends/ids.json"   (mkUserParam q) "ids"
 followersIds q = apiCursor "followers/ids.json" (mkUserParam q) "ids"

+friendsList
+  :: TwitterBaseM m => UserParam -> C.Source (TW m) User
+friendsList q = apiCursor "friends/list.json" (mkUserParam q) "users"
+
 usersShow :: TwitterBaseM m => UserParam -> TW m User
 usersShow q = apiGet "users/show.json" (mkUserParam q)

any plan to support extended tweets?

Context: https://developer.twitter.com/en/docs/tweets/tweet-updates.html

In short:

  • tweets with content length > 140 is truncated in Compatibility mode for standard REST API
  • for REST API one can use tweet_mode=extended but the structure no longer matches Status type (e.g. text does not exist and replaced with full_text), however truncated is an indicator to which of text and full_text is available.(edited, see below)
  • for standard streaming API however, an extra field extended_tweet is added instead of replacing text .
  • it seems different rule applies to Enterprise and Premium API, but I don't have access to them to see what's going on.

I'm only using the REST API part of twitter-conduit and might patch this repo to work fine just for my own purpose (expect a PR from me if I end up have it working in a not-so-hacky way), but in long run I want to see if there's a plan to have this supported nicely.

Sorry if it all sounds complicated and confusing because it is (thank you twitter!)

Edit: after investigating a little bit, it turns out truncated is not an indicator for whether "text" or "full_text" is available: truncated will always be false in extended mode, but it could be true or false in compatible mode depending on whether the actual text is truncated. a temporary fix will be replacing o .: "text" with (o .: "text") <|> (o .: "full_text") when parsing Status in twitter-types, so that regardless of extended mode, statusText will always refer to the full text.

typos in README

The links for the sample.hs and the samples directory are wrong.

"We would like to thank all, which" is probably better as "...thank everyone who"

Cannot build: ambiguous occurance `UploadedMedia`

ollie@nixos ~/nixpkgs> nix-build -A haskellPackages.twitterConduit
these derivations will be built:
  /nix/store/4r6rm71m5gq7l1m1z25yr56d45p5pglb-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared.drv
building path(s) `/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared'
building /nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared
unpacking sources
unpacking source archive /nix/store/146pblf0rbnsfa4m9h16lq4n6wvs78cd-twitter-conduit-0.0.5.6.tar.gz
source root is twitter-conduit-0.0.5.6
patching sources
configuring
[1 of 1] Compiling Main             ( Setup.hs, /tmp/nix-build-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared.drv-0/Main.o )
Linking Setup ...
configure flags: --enable-split-objs --disable-library-profiling --enable-shared --enable-library-vanilla --enable-executable-dynamic --enable-tests  --ghc-option=-optl=-Wl,-rpath=/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared/lib/ghc-7.8.3/twitter-conduit-0.0.5.6 --ghc-option=-j8
Configuring twitter-conduit-0.0.5.6...
Flags chosen: run-integrated-test=False, use-debug-output=False,
build-samples=False, lens-aeson=True, network-uri=True
Dependency aeson >=0.7.0.5: using aeson-0.8.0.0
Dependency attoparsec >=0.10: using attoparsec-0.12.1.1
Dependency authenticate-oauth >=1.3: using authenticate-oauth-1.5
Dependency base >=4.5 && <5: using base-4.7.0.1
Dependency bytestring >=0.9: using bytestring-0.10.4.0
Dependency case-insensitive -any: using case-insensitive-1.2.0.0
Dependency conduit >=1.1: using conduit-1.1.7
Dependency conduit-extra >=1.1: using conduit-extra-1.1.3.2
Dependency containers -any: using containers-0.5.5.1
Dependency data-default >=0.3: using data-default-0.5.3
Dependency directory -any: using directory-1.2.1.0
Dependency doctest -any: using doctest-0.9.11
Dependency filepath -any: using filepath-1.3.0.2
Dependency hlint >=1.7: using hlint-1.9.3
Dependency hspec -any: using hspec-1.11.3
Dependency http-client >=0.3: using http-client-0.3.7.2
Dependency http-conduit >=2.0 && <2.2: using http-conduit-2.1.4
Dependency http-types -any: using http-types-0.8.5
Dependency lens >=4.0 && <4.5: using lens-4.4.0.1
Dependency lens-aeson >=1: using lens-aeson-1
Dependency monad-control -any: using monad-control-0.3.3.0
Dependency monad-logger -any: using monad-logger-0.3.7.1
Dependency network-uri >=2.6: using network-uri-2.6.0.0
Dependency resourcet >=1.0: using resourcet-1.1.2.3
Dependency template-haskell -any: using template-haskell-2.9.0.0
Dependency text >=0.11: using text-1.1.1.3
Dependency time -any: using time-1.4.2
Dependency transformers >=0.2.2: using transformers-0.3.0.0
Dependency transformers-base -any: using transformers-base-0.4.3
Dependency twitter-types >=0.4.0: using twitter-types-0.5.0
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc --info
Using Cabal-1.18.1.3 compiled by ghc-7.8
Using compiler: ghc-7.8.3
Using install prefix:
/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared
Binaries installed in:
/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared/bin
Libraries installed in:
/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared/lib/ghc-7.8.3/twitter-conduit-0.0.5.6
Private binaries installed in:
/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared/libexec
Data files installed in:
/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared/share/x86_64-linux-ghc-7.8.3/twitter-conduit-0.0.5.6
Documentation installed in:
/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared/share/doc/x86_64-linux-ghc-7.8.3/twitter-conduit-0.0.5.6
Configuration files installed in:
/nix/store/vy1f803h22qxkyvgq1v0s95g3dl16qxc-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared/etc
No alex found
Using ar found on system at:
/nix/store/ngsbygsjzv0fbj1543306l0a48qqy1vs-binutils-2.23.1/bin/ar
No c2hs found
Using cpphs version 1.18.5 found on system at:
/nix/store/sd2b4jsjbrshlffmjii458lh39a921wy-haskell-cpphs-ghc7.8.3-1.18.5-shared/bin/cpphs
No ffihugs found
Using gcc version 4.8.3 found on system at:
/nix/store/085j31s6pfdwn6xl1g0x3i4pjcn2wvwf-gcc-wrapper-4.8.3/bin/gcc
Using ghc version 7.8.3 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc
Using ghc-pkg version 7.8.3 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc-pkg
No greencard found
Using haddock version 2.14.3 found on system at:
/nix/store/kb4kpcvmiiacvfabjldk7590js6v1f41-ghc-7.8.3/bin/haddock
No happy found
No hmake found
Using hpc version 0.67 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/hpc
Using hsc2hs version 0.67 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/hsc2hs
Using hscolour version 1.20 found on system at:
/nix/store/y9c8j6j1995cbdmadv9qn2bxq1fnm5ci-haskell-hscolour-ghc7.8.3-1.20.3-shared/bin/HsColour
No hugs found
No jhc found
Using ld found on system at:
/nix/store/085j31s6pfdwn6xl1g0x3i4pjcn2wvwf-gcc-wrapper-4.8.3/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
No pkg-config found
Using ranlib found on system at:
/nix/store/ngsbygsjzv0fbj1543306l0a48qqy1vs-binutils-2.23.1/bin/ranlib
Using strip found on system at:
/nix/store/ngsbygsjzv0fbj1543306l0a48qqy1vs-binutils-2.23.1/bin/strip
Using tar found on system at:
/nix/store/jff4a6zqi0yrladx3kwy4v6844s3swpc-gnutar-1.27.1/bin/tar
No uhc found
building
Building twitter-conduit-0.0.5.6...
Preprocessing library twitter-conduit-0.0.5.6...
[ 1 of 13] Compiling Web.Twitter.Conduit.Parameters.Internal ( Web/Twitter/Conduit/Parameters/Internal.hs, dist/build/Web/Twitter/Conduit/Parameters/Internal.o )
[ 2 of 13] Compiling Web.Twitter.Conduit.Parameters.TH ( Web/Twitter/Conduit/Parameters/TH.hs, dist/build/Web/Twitter/Conduit/Parameters/TH.o )
[ 3 of 13] Compiling Web.Twitter.Conduit.Types.TH ( Web/Twitter/Conduit/Types/TH.hs, dist/build/Web/Twitter/Conduit/Types/TH.o )
[ 4 of 13] Compiling Web.Twitter.Conduit.Types ( Web/Twitter/Conduit/Types.hs, dist/build/Web/Twitter/Conduit/Types.o )
[ 5 of 13] Compiling Web.Twitter.Conduit.Types.Lens ( Web/Twitter/Conduit/Types/Lens.hs, dist/build/Web/Twitter/Conduit/Types/Lens.o )
[ 6 of 13] Compiling Web.Twitter.Conduit.Parameters ( Web/Twitter/Conduit/Parameters.hs, dist/build/Web/Twitter/Conduit/Parameters.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package text-1.1.1.3 ... linking ... done.
Loading package hashable-1.2.2.0 ... linking ... done.
Loading package scientific-0.3.3.0 ... linking ... done.
Loading package attoparsec-0.12.1.1 ... linking ... done.
Loading package dlist-0.7.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package syb-0.4.2 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package unordered-containers-0.2.5.0 ... linking ... done.
Loading package primitive-0.5.3.0 ... linking ... done.
Loading package vector-0.10.11.0 ... linking ... done.
Loading package aeson-0.8.0.0 ... linking ... done.
Loading package blaze-builder-0.3.3.2 ... linking ... done.
Loading package case-insensitive-1.2.0.0 ... linking ... done.
Loading package http-types-0.8.5 ... linking ... done.
Loading package twitter-types-0.5.0 ... linking ... done.
Loading package exceptions-0.6.1 ... linking ... done.
Loading package stm-2.4.3 ... linking ... done.
Loading package transformers-base-0.4.3 ... linking ... done.
Loading package monad-control-0.3.3.0 ... linking ... done.
Loading package lifted-base-0.2.3.0 ... linking ... done.
Loading package mmorph-1.0.3 ... linking ... done.
Loading package resourcet-1.1.2.3 ... linking ... done.
Loading package nats-0.2 ... linking ... done.
Loading package semigroups-0.15.2 ... linking ... done.
Loading package void-0.6.1 ... linking ... done.
Loading package conduit-1.1.7 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package unix-2.7.0.1 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package parsec-3.1.5 ... linking ... done.
Loading package network-2.5.0.0 ... linking ... done.
Loading package process-1.2.0.0 ... linking ... done.
Loading package random-1.0.1.3 ... linking ... done.
Loading package zlib-0.5.4.1 ... linking ... done.
Loading package streaming-commons-0.1.4.2 ... linking ... done.
Loading package conduit-extra-1.1.3.2 ... linking ... done.
Loading package auto-update-0.1.1.2 ... linking ... done.
Loading package fast-logger-2.2.0 ... linking ... done.
Loading package monad-loops-0.4.2.1 ... linking ... done.
Loading package stm-chans-3.0.0.2 ... linking ... done.
Loading package monad-logger-0.3.7.1 ... linking ... done.
Loading package transformers-compat-0.3.3 ... linking ... done.
Loading package contravariant-1.2 ... linking ... done.
Loading package tagged-0.7.2 ... linking ... done.
Loading package distributive-0.4.4 ... linking ... done.
Loading package comonad-4.2.2 ... linking ... done.
Loading package semigroupoids-4.2 ... linking ... done.
Loading package bifunctors-4.1.1.1 ... linking ... done.
Loading package prelude-extras-0.4 ... linking ... done.
Loading package profunctors-4.2.0.1 ... linking ... done.
Loading package free-4.9 ... linking ... done.
Loading package parallel-3.2.0.4 ... linking ... done.
Loading package reflection-1.5.1 ... linking ... done.
Loading package split-0.2.2 ... linking ... done.
Loading package lens-4.4.0.1 ... linking ... done.
Loading package lens-aeson-1 ... linking ... done.
Loading package base64-bytestring-1.0.0.1 ... linking ... done.
Loading package data-default-class-0.0.1 ... linking ... done.
Loading package data-default-instances-base-0.0.1 ... linking ... done.
Loading package data-default-instances-containers-0.0.1 ... linking ... done.
Loading package data-default-instances-dlist-0.0.1 ... linking ... done.
Loading package data-default-instances-old-locale-0.0.1 ... linking ... done.
Loading package data-default-0.5.3 ... linking ... done.
Loading package cookie-0.4.1.3 ... linking ... done.
Loading package mime-types-0.1.0.4 ... linking ... done.
Loading package cereal-0.4.0.1 ... linking ... done.
Loading package utf8-string-0.3.8 ... linking ... done.
Loading package publicsuffixlist-0.1 ... linking ... done.
Loading package http-client-0.3.7.2 ... linking ... done.
Loading package byteable-0.1.1 ... linking ... done.
Loading package securemem-0.1.3 ... linking ... done.
Loading package crypto-cipher-types-0.0.9 ... linking ... done.
Loading package cipher-aes-0.2.8 ... linking ... done.
Loading package crypto-random-0.0.7 ... linking ... done.
Loading package cprng-aes-0.5.2 ... linking ... done.
Loading package socks-0.5.4 ... linking ... done.
Loading package asn1-types-0.2.3 ... linking ... done.
Loading package asn1-encoding-0.8.1.3 ... linking ... done.
Loading package cipher-des-0.0.6 ... linking ... done.
Loading package cipher-rc4-0.1.4 ... linking ... done.
Loading package crypto-numbers-0.2.3 ... linking ... done.
Loading package crypto-pubkey-types-0.4.2.2 ... linking ... done.
Loading package cryptohash-0.11.6 ... linking ... done.
Loading package crypto-pubkey-0.2.4 ... linking ... done.
Loading package asn1-parse-0.8.1 ... linking ... done.
Loading package pem-0.2.2 ... linking ... done.
Loading package x509-1.4.11 ... linking ... done.
Loading package x509-store-1.4.4 ... linking ... done.
Loading package x509-validation-1.5.0 ... linking ... done.
Loading package tls-1.2.8 ... linking ... done.
Loading package x509-system-1.4.5 ... linking ... done.
Loading package connection-0.2.3 ... linking ... done.
Loading package http-client-tls-0.2.2 ... linking ... done.
Loading package http-conduit-2.1.4 ... linking ... done.
Loading package binary-0.7.1.0 ... linking ... done.
Loading package SHA-1.6.4.1 ... linking ... done.
Loading package entropy-0.3.2 ... linking ... done.
Loading package crypto-api-0.13 ... linking ... done.
Loading package monadcryptorandom-0.6.1 ... linking ... done.
Loading package pureMD5-2.1.2.1 ... linking ... done.
Loading package RSA-2.0.0 ... linking ... done.
Loading package blaze-builder-conduit-1.1.0 ... linking ... done.
Loading package authenticate-oauth-1.5 ... linking ... done.
[ 7 of 13] Compiling Web.Twitter.Conduit.Request ( Web/Twitter/Conduit/Request.hs, dist/build/Web/Twitter/Conduit/Request.o )
[ 8 of 13] Compiling Web.Twitter.Conduit.Monad ( Web/Twitter/Conduit/Monad.hs, dist/build/Web/Twitter/Conduit/Monad.o )
[ 9 of 13] Compiling Web.Twitter.Conduit.Base ( Web/Twitter/Conduit/Base.hs, dist/build/Web/Twitter/Conduit/Base.o )
[10 of 13] Compiling Web.Twitter.Conduit.Api ( Web/Twitter/Conduit/Api.hs, dist/build/Web/Twitter/Conduit/Api.o )

Web/Twitter/Conduit/Api.hs:643:39:
    Ambiguous occurrence ‘UploadedMedia’
    It could refer to either ‘Web.Twitter.Types.UploadedMedia’,
                             imported from ‘Web.Twitter.Types’ at Web/Twitter/Conduit/Api.hs:136:1-24
                          or ‘Web.Twitter.Conduit.Types.UploadedMedia’,
                             imported from ‘Web.Twitter.Conduit.Types’ at Web/Twitter/Conduit/Api.hs:137:1-32
                             (and originally defined
                                at Web/Twitter/Conduit/Types.hs:(99,1)-(103,19))
[11 of 13] Compiling Web.Twitter.Conduit.Status ( Web/Twitter/Conduit/Status.hs, dist/build/Web/Twitter/Conduit/Status.o )
[12 of 13] Compiling Web.Twitter.Conduit.Stream ( Web/Twitter/Conduit/Stream.hs, dist/build/Web/Twitter/Conduit/Stream.o )
builder for `/nix/store/4r6rm71m5gq7l1m1z25yr56d45p5pglb-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared.drv' failed with exit code 1
error: build of `/nix/store/4r6rm71m5gq7l1m1z25yr56d45p5pglb-haskell-twitter-conduit-ghc7.8.3-0.0.5.6-shared.drv' failed

Is v2 API support considered/planned?

Hi,

First of all congratulations for your work, it's a pleasure to work with twitter-conduit! I was wondering if support for the new Twitter API v2 is planned for this library. I could take advantage of some of its functionalities... Thanks and regards!

[PATCH] [RFC] add usersLookup

I've got a function working corresponding to the users/lookup endpoint, but I'm not sure it is done in the style of the twitter-conduit library. The function looks like this:

usersLookup
  :: TwitterBaseM m 
  => [String] -> TW m [User]
usersLookup qs = apiGet "users/lookup.json" [("user_id", B8.pack (cls qs))]
             where cls = intercalate ","

The user_id parameter to the Tw API expects a comma-separated list of user ids. I assume this function is unacceptable as is. Perhaps someone can alter this to make it more suitable?

Is it possible to get access to a Response?

I'd like a function like callWithResponse :: APIRequest apiName responseType -> TW m (Response, responseType) which would let me access the Response that Twitter sends back. In particular, I'd like access to the Date header on the accountVerifyCredentials API. I tried writing such a function based on the implementation of call, but couldn't easily because getValueOrThrow wasn't exported.

Ambiguous module name leads to doctest failure

Web/Twitter/Conduit/Parameters.hs:51:8:
    Ambiguous module name ‘Web.Twitter.Types’:
      it was found in multiple packages:
      twitter-feed-0.2.0.4@twitt_GQHvwlkXDKMEgcrMk85tVz twitter-types-0.7.1@twitt_I5DK3jRp7B98JOBUWzvNj8
Test suite doctests: FAIL
Test suite logged to: /home/stackage/work/logs/nightly/twitter-conduit-0.1.1/test-run.out
Test suite spec_main: RUNNING...

Error_Packet "partial packet: ... "

When using the streaming API, if I ask question on big volume keywords "the,this,RT,lol" I get this error.

Error_Packet "partial packet: ... "

My problem is that I don't know how to handle this error correctly. I would like my program to try to continue receiving tweets instead cutting the connection.

I don't really know how to start to fix this issue, tell me if it is somewhere in twitter-conduit in which case I'll do my best to help or if I should handle this error in my code.

Upload newest version to hackage

Hi, a project of mine is failing to compile. I'm working around it now by downloading twitter-conduit from source but was wondering if you could please update it on Hackage so this workaround isn't necessary.

Thanks!

Direct messages not working - deprecated API

Hi,
when trying to send a direct message I get this error:

TwitterErrorMessage {twitterErrorCode = 34, twitterErrorMessage = "Sorry, that page does not exist."}

It seems that the Twitter API changed for direct messages:
https://twittercommunity.com/t/details-and-what-to-expect-from-the-api-deprecations-this-week-on-august-16-2018/110746

New API uses events: https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event

twProxy in TWInfo

What is the point of providing means to set HTTP proxy via TWInfo rather than relying on the proxy already being set in the HTTP.Manager used by the API calls? Seems confusing.

Nix package fails, and is marked as broken due to HLint failure.

I had been unable to build a project of my own using this library with Stack's nix integration, as the nix package fails (and is currently marked as broken!) to build due to the hlint failure. I'm not sure whether it's supposed to cause build failure like this, or whether something else in nixpkgs is causing this...

Nix package. (twitter-conduit is at lines 254024-264054)

Test suite hlint: RUNNING...
Web/Twitter/Conduit/Response.hs:2:1-31: Warning: Unused LANGUAGE pragma
Found:
  {-# LANGUAGE DeriveFoldable #-}
Perhaps you should remove it.
Note: Extension DeriveFoldable is implied by DeriveTraversable

Web/Twitter/Conduit/Response.hs:3:1-30: Warning: Unused LANGUAGE pragma
Found:
  {-# LANGUAGE DeriveFunctor #-}
Perhaps you should remove it.
Note: Extension DeriveFunctor is implied by DeriveTraversable

2 hints
Test suite hlint: FAIL

Build failure with Cabal 2.0

> /tmp/stackage-build13$ stack unpack twitter-conduit-0.2.2.1@gitsha1:d1fa48e2f2121d4f171cef1660d8663b6ccfd0e9
Unpacked twitter-conduit-0.2.2.1 to /tmp/stackage-build13/twitter-conduit-0.2.2.1/
> /tmp/stackage-build13/twitter-conduit-0.2.2.1$ ghc -clear-package-db -global-package-db -package-db=/var/stackage/work/builds/nightly/pkgdb Setup
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )

Setup.hs:8:30: error:
    Module
    ‘Distribution.Package’
    does not export
    ‘PackageName(PackageName)’
  |
8 | import Distribution.Package (PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName)
  |              

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.