Skip to content

Commit fe7445c

Browse files
author
Aaron Gonzales
authored
Merge pull request #13 from twitterdev/rename_package
Rename package for pypi
2 parents 4a7bba4 + 402f583 commit fe7445c

File tree

14 files changed

+72
-63
lines changed

14 files changed

+72
-63
lines changed

README.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Python Twitter Search API
33

44
This library serves as a python interface to the `Twitter premium and enterprise search APIs <https://developer.twitter.com/en/docs/tweets/search/overview/30-day-search>`_. It provides a command-line utility and a library usable from within python. It comes with tools for assisting in dynamic generation of search rules and for parsing tweets.
55

6-
Pretty docs can be seen `here <https://twitterdev.github.io/twitter_search_api/>`_.
6+
Pretty docs can be seen `here <https://twitterdev.github.io/search_tweets_api/>`_.
77

88

99
Features
@@ -22,26 +22,26 @@ Features
2222
Installation
2323
============
2424

25-
We will soon handle releases via PyPy, but you can also install the current master version via
25+
We will host the package on PyPi so it's pip-friendly.
2626

2727
.. code:: bash
2828
29-
pip install git+https://github.com/twitterdev/twitter_search_api.git
29+
pip install searchtweets
3030
3131
Or the development version locally via
3232

3333
.. code:: bash
3434
35-
git clone https://github.com/twitterdev/twitter_search_api.git
36-
cd twitter_search_api
35+
git clone https://github.com/twitterdev/search-tweets-python
36+
cd search-tweets-python
3737
pip install -e .
3838
3939
4040
4141
Using the Comand Line Application
4242
=================================
4343

44-
We provide a utility, ``twitter_search.py``, in the ``tools`` directory that provides rapid access to tweets.
44+
We provide a utility, ``search_tweets.py``, in the ``tools`` directory that provides rapid access to tweets.
4545
Premium customers should use ``--bearer-token``; enterprise customers should use ``--user-name`` and ``--password``.
4646

4747
The ``--endpoint`` flag will specify the full URL of your connection, e.g.:
@@ -61,7 +61,7 @@ Note that the ``--results-per-call`` flag specifies an argument to the API call
6161

6262
.. code:: bash
6363
64-
python twitter_search.py \
64+
python search_tweets.py \
6565
--bearer-token <BEARER_TOKEN> \
6666
--endpoint <MY_ENDPOINT> \
6767
--max-results 1000 \
@@ -74,7 +74,7 @@ Note that the ``--results-per-call`` flag specifies an argument to the API call
7474

7575
.. code:: bash
7676
77-
python twitter_search.py \
77+
python search_tweets.py \
7878
--user-name <USERNAME> \
7979
--password <PW> \
8080
--endpoint <MY_ENDPOINT> \
@@ -89,7 +89,7 @@ Note that the ``--results-per-call`` flag specifies an argument to the API call
8989

9090
.. code:: bash
9191
92-
python twitter_search.py \
92+
python search_tweets.py \
9393
--user-name <USERNAME> \
9494
--password <PW> \
9595
--endpoint <MY_ENDPOINT> \
@@ -134,7 +134,7 @@ When using a config file in conjunction with the command-line utility, you need
134134

135135
Example::
136136

137-
python twitter_search_api.py \
137+
python search_tweets.py \
138138
--config-file myapiconfig.config \
139139
--no-print-stream
140140

@@ -160,7 +160,7 @@ Your credentials should be put into a YAML file that looks like this:
160160
.. code:: yaml
161161
162162
163-
twitter_search_api:
163+
search_tweets_api:
164164
endpoint: <FULL_URL_OF_ENDPOINT>
165165
account: <ACCOUNT_NAME>
166166
username: <USERNAME>
@@ -181,7 +181,7 @@ throughout your program's session.
181181

182182
.. code:: python
183183
184-
from twittersearch import ResultStream, gen_rule_payload, load_credentials
184+
from searchtweets import ResultStream, gen_rule_payload, load_credentials
185185
186186
Enterprise setup
187187
----------------
@@ -257,7 +257,7 @@ Let's see how it goes:
257257

258258
.. code:: python
259259
260-
from twittersearch import collect_results
260+
from searchtweets import collect_results
261261
262262
.. code:: python
263263

docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# You can set these variables from the command line.
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
7-
SPHINXPROJ = twittersearchapi
7+
SPHINXPROJ = searchtweetsapi
88
SOURCEDIR = source
99
BUILDDIR = build
1010

@@ -17,4 +17,4 @@ help:
1717
# Catch-all target: route all unknown targets to Sphinx using the new
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
20-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/source/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
master_doc = 'index'
5656

5757
# General information about the project.
58-
project = 'twitter search api'
58+
project = 'Twitter Search APIs Python Wrapper'
5959
copyright = '2017, twitterdev'
6060
author = 'twitterdev'
6161

@@ -64,9 +64,9 @@
6464
# built documents.
6565
#
6666
# The short X.Y version.
67-
version = '0.1'
67+
version = '1.0'
6868
# The full version, including alpha/beta/rc tags.
69-
release = '0.1'
69+
release = '1.0b'
7070

7171
# The language for content autogenerated by Sphinx. Refer to documentation
7272
# for a list of supported languages.
@@ -112,7 +112,7 @@
112112
# -- Options for HTMLHelp output ------------------------------------------
113113

114114
# Output file base name for HTML help builder.
115-
htmlhelp_basename = 'twittersearchdoc'
115+
htmlhelp_basename = 'searchtweetsdoc'
116116

117117

118118
# -- Options for LaTeX output ---------------------------------------------
@@ -139,7 +139,7 @@
139139
# (source start file, target name, title,
140140
# author, documentclass [howto, manual, or own class]).
141141
latex_documents = [
142-
(master_doc, 'twittersearch.tex', 'twitter search api Documentation',
142+
(master_doc, 'searchtweets.tex', 'twitter search api Documentation',
143143
'twitterdev', 'manual'),
144144
]
145145

@@ -149,7 +149,7 @@
149149
# One entry per manual page. List of tuples
150150
# (source start file, name, description, authors, manual section).
151151
man_pages = [
152-
(master_doc, 'twittersearch', 'twitter search api Documentation',
152+
(master_doc, 'searchtweets', 'twitter search api Documentation',
153153
[author], 1)
154154
]
155155

@@ -160,8 +160,8 @@
160160
# (source start file, target name, title, author,
161161
# dir menu entry, description, category)
162162
texinfo_documents = [
163-
(master_doc, 'twittersearch', 'twitter search api Documentation',
164-
author, 'twittersearch', 'One line description of project.',
163+
(master_doc, 'searchtweets', 'twitter search api Documentation',
164+
author, 'searchtweets', 'One line description of project.',
165165
'Miscellaneous'),
166166
]
167167

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
:caption: Contents:
1212

1313
self
14-
twittersearch
14+
searchtweets
1515

1616

1717

docs/source/modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
twittersearch
1+
searchtweets
22
=============
33

44
.. toctree::
55
:maxdepth: 4
66

7-
twittersearch
7+
searchtweets
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
twittersearch package
1+
searchtweets package
22
=====================
33

44
Submodules
55
----------
66

7-
twittersearch\.api\_utils module
7+
searchtweets\.api\_utils module
88
--------------------------------
99

10-
.. automodule:: twittersearch.api_utils
10+
.. automodule:: searchtweets.api_utils
1111
:members:
1212
:undoc-members:
1313
:show-inheritance:
1414

15-
twittersearch\.result\_stream module
15+
searchtweets\.result\_stream module
1616
------------------------------------
1717

18-
.. automodule:: twittersearch.result_stream
18+
.. automodule:: searchtweets.result_stream
1919
:members:
2020
:undoc-members:
2121
:show-inheritance:
2222

23-
twittersearch\.utils module
23+
searchtweets\.utils module
2424
---------------------------
2525

26-
.. automodule:: twittersearch.utils
26+
.. automodule:: searchtweets.utils
2727
:members:
2828
:undoc-members:
2929
:show-inheritance:
@@ -32,7 +32,7 @@ twittersearch\.utils module
3232
Module contents
3333
---------------
3434

35-
.. automodule:: twittersearch
35+
.. automodule:: searchtweets
3636
:members:
3737
:undoc-members:
3838
:show-inheritance:

examples/api_example.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"outputs": [],
4343
"source": [
44-
"from twittersearch import ResultStream, gen_rule_payload, load_credentials"
44+
"from searchtweets import ResultStream, gen_rule_payload, load_credentials"
4545
]
4646
},
4747
{
@@ -149,7 +149,7 @@
149149
},
150150
"outputs": [],
151151
"source": [
152-
"from twittersearch import collect_results"
152+
"from searchtweets import collect_results"
153153
]
154154
},
155155
{

examples/readme.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ throughout your program's session.
4141

4242
.. code:: python
4343
44-
from twittersearch import ResultStream, gen_rule_payload, load_credentials
44+
from searchtweets import ResultStream, gen_rule_payload, load_credentials
4545
4646
Enterprise setup
4747
----------------
@@ -117,7 +117,7 @@ Let's see how it goes:
117117

118118
.. code:: python
119119
120-
from twittersearch import collect_results
120+
from searchtweets import collect_results
121121
122122
.. code:: python
123123
File renamed without changes.

twittersearch/api_utils.py renamed to searchtweets/api_utils.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import json
1616

1717
__all__ = ["gen_rule_payload", "gen_params_from_config", "load_credentials",
18-
"infer_endpoint",
18+
"infer_endpoint", "convert_utc_time",
1919
"validate_count_api", "GNIP_RESP_CODES", "change_to_count_endpoint"]
2020

2121
logger = logging.getLogger(__name__)
@@ -65,7 +65,7 @@ def convert_utc_time(datetime_str):
6565
string of GNIP API formatted date.
6666
6767
Example:
68-
>>> from twittersearch.utils import convert_utc_time
68+
>>> from searchtweets.utils import convert_utc_time
6969
>>> convert_utc_time("201708020000")
7070
'201708020000'
7171
>>> convert_utc_time("2017-08-02")
@@ -136,7 +136,7 @@ def gen_rule_payload(pt_rule, results_per_call=500,
136136
137137
Example:
138138
139-
>>> from twittersearch.utils import gen_rule_payload
139+
>>> from searchtweets.utils import gen_rule_payload
140140
>>> gen_rule_payload("kanye west has:geo",
141141
... from_date="2017-08-21",
142142
... to_date="2017-08-22")
@@ -221,12 +221,12 @@ def validate_count_api(rule_payload, endpoint):
221221

222222
def load_credentials(filename=None, account_type=None):
223223
"""
224-
handlles credeintial managmenet via a YAML file. YAML files should look
224+
Handles credeintial managmenet via a YAML file. YAML files should look
225225
like this:
226226
227227
.. code:: yaml
228228
229-
twitter_search_api:
229+
search_tweets_api:
230230
endpoint: <FULL_URL_OF_ENDPOINT>
231231
account: <ACCOUNT_NAME>
232232
username: <USERNAME>
@@ -240,21 +240,22 @@ def load_credentials(filename=None, account_type=None):
240240
default '~/.twitter_keys.yaml'
241241
account_type (str): pass your account type, "premium" or "enterprise"
242242
243-
Returns: dict of your access credentials.
243+
Returns:
244+
dict of your access credentials.
244245
245246
Example:
246-
>>> from twittersearch.api_utils import load_credentials
247-
>>> search_args = load_credentials(account_type="premium")
248-
>>> search_args.keys()
249-
dict_keys(['bearer_token', 'endpoint'])
247+
>>> from searchtweets.api_utils import load_credentials
248+
>>> search_args = load_credentials(account_type="premium")
249+
>>> search_args.keys()
250+
dict_keys(['bearer_token', 'endpoint'])
250251
251252
"""
252253
if account_type is None or account_type not in {"premium", "enterprise"}:
253254
logger.error("You must provide either 'premium' or 'enterprise' here")
254255
raise KeyError
255256
filename = "~/.twitter_keys.yaml" if filename is None else filename
256257
with open(os.path.expanduser(filename)) as f:
257-
search_creds = yaml.load(f)["twitter_search_api"]
258+
search_creds = yaml.load(f)["search_tweets_api"]
258259

259260
try:
260261

0 commit comments

Comments
 (0)