r"""Construct a Twitter API url, encoded, with parameters :param api_url: URL of the Twitter API endpoint you are attempting to construct :param \*\*params: Parameters that are accepted by Twitter for the endpoint you're requesting :rtype: string Usa
(api_url, **params)
| 431 | |
| 432 | @staticmethod |
| 433 | def construct_api_url(api_url, **params): |
| 434 | r"""Construct a Twitter API url, encoded, with parameters |
| 435 | |
| 436 | :param api_url: URL of the Twitter API endpoint you are attempting |
| 437 | to construct |
| 438 | :param \*\*params: Parameters that are accepted by Twitter for the |
| 439 | endpoint you're requesting |
| 440 | :rtype: string |
| 441 | |
| 442 | Usage:: |
| 443 | |
| 444 | >>> from twython import Twython |
| 445 | >>> twitter = Twython() |
| 446 | |
| 447 | >>> api_url = 'https://api.twitter.com/1.1/search/tweets.json' |
| 448 | >>> constructed_url = twitter.construct_api_url(api_url, q='python', |
| 449 | result_type='popular') |
| 450 | >>> print constructed_url |
| 451 | https://api.twitter.com/1.1/search/tweets.json?q=python&result_type=popular |
| 452 | |
| 453 | """ |
| 454 | querystring = [] |
| 455 | params, _ = _transparent_params(params or {}) |
| 456 | params = requests.utils.to_key_val_list(params) |
| 457 | for (k, v) in params: |
| 458 | querystring.append( |
| 459 | '%s=%s' % (Twython.encode(k), quote_plus(Twython.encode(v))) |
| 460 | ) |
| 461 | return '%s?%s' % (api_url, '&'.join(querystring)) |
| 462 | |
| 463 | def search_gen(self, search_query, **params): # pragma: no cover |
| 464 | warnings.warn( |