Skip to content

Commit

Permalink
test coveralls on azure pipelines fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Álvaro Bartolomé del Canto committed Aug 16, 2019
1 parent 8431eb1 commit f46707a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
setuptools==40.6.3
setuptools==41.1.0
requests_oauthlib==1.2.0
requests==2.22.0
oauth2==1.9.0.post1
6 changes: 3 additions & 3 deletions tests/test_twipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os

from twipper.credentials import Twipper

import twipper.batch as batch
import twipper.streaming as stream
import twipper.premium as premium
Expand All @@ -22,6 +21,7 @@ def test_twipper():
access_token_secret=os.environ['access_token_secret'])

credentials.plan = 'fullarchive'
credentials.label = 'research'

try:
batch.search_tweets(access=credentials,
Expand All @@ -44,14 +44,14 @@ def test_twipper():
query='futbol',
language='es',
filter_retweets=False,
tweet_limit=3,
tweet_limit=10,
retry='no_limit')

stream.stream_country_tweets(access=credentials,
country='spain',
language='es',
filter_retweets=False,
tweet_limit=3,
tweet_limit=10,
retry='no_limit')

premium.search_tweets(access=credentials,
Expand Down
9 changes: 4 additions & 5 deletions twipper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import requests


def available_languages(access):
def available_languages(api):
"""
This function retrieves all the languages in which the language of a tweet can be detected,
as they are the languages that Twitter works with. This function allows the system to check if
the introduced language to a function is a valid one or not. API Reference:
https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages.html
Args:
access (:obj:`twipper.credentials.Twipper`): object containing all the credentials needed to access api.twitter
api (:obj:`oauth2.Client`): api object with access to api.twitter
Returns:
:obj:`list` - languages:
Expand All @@ -29,14 +29,13 @@ def available_languages(access):
IndexError: raised if the retrieved languages `list` is empty.
"""

api = access.api

url = 'https://api.twitter.com/1.1/help/languages.json'

response, content = api.request(url, method='GET')

if response.status != 200:
raise ConnectionError('connection to `api.twitter` could not be established.')
raise ConnectionError('connection to `api.twitter` could not be established (HTTP Error ' +
str(response.status) + ').')

try:
data = json.loads(content.decode('utf-8'))
Expand Down

0 comments on commit f46707a

Please sign in to comment.