Twitter api
post_tweet(tweet_text, pkg_id)
¶
Attempts to post the tweet. Returns a boolean success variable and a message describing the reason for the failure/success in posting the tweet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tweet_text |
The text to post. This is passed in rather than generated inside the method to allow users to change the tweet before posting (if enabled). |
required | |
pkg_id |
The package ID (for caching). |
required |
Returns:
| Type | Description |
|---|---|
|
boolean, str |
Source code in ckanext/twitter/lib/twitter_api.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
twitter_authenticate()
¶
Verifies that the client is able to connect to the twitter API.
Refreshes any unauthenticated cached client.
Returns:
| Type | Description |
|---|---|
|
boolean |
Source code in ckanext/twitter/lib/twitter_api.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
twitter_client()
¶
Attempts to create a client for accessing the twitter API using the credentials specified in the configuration file. Does not test for success. Caches the resulting client in the 'twitter' cache.
Returns:
| Type | Description |
|---|---|
|
oauth2.Client |
Source code in ckanext/twitter/lib/twitter_api.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |