summaryrefslogtreecommitdiff
path: root/python-twittersearch.spec
blob: c56aa0a5b34e9d518a25163ae91a759ae2fae34c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
69
70
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
%global _empty_manifest_terminate_build 0
Name:		python-TwitterSearch
Version:	1.0.2
Release:	1
Summary:	A library to easily iterate tweets found by the Twitter API
License:	MIT
URL:		http://github.com/ckoepp/TwitterSearch
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/52/77/3731f0d25c97ef1d1e5d034563f9e8ec2445946c1633b3813c22c7f363ee/TwitterSearch-1.0.2.tar.gz
BuildArch:	noarch


%description
*************
TwitterSearch
*************

.. image:: https://img.shields.io/travis/ckoepp/TwitterSearch/master.svg?style=flat-square
    :target: http://travis-ci.org/ckoepp/TwitterSearch/branches
    :alt: Build Status

.. image:: https://img.shields.io/coveralls/ckoepp/TwitterSearch.svg?style=flat-square
    :target: https://coveralls.io/r/ckoepp/TwitterSearch?branch=master
    :alt: Coverage
    
.. image:: https://landscape.io/github/ckoepp/TwitterSearch/master/landscape.svg?style=flat-square
    :target: https://landscape.io/github/ckoepp/TwitterSearch/master
    :alt: Code Health

.. image:: https://img.shields.io/pypi/v/TwitterSearch.svg?style=flat-square
    :target: https://pypi.python.org/pypi/TwitterSearch/
    :alt: PyPi version
	
.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
    :target: https://raw.githubusercontent.com/ckoepp/TwitterSearch/master/LICENSE
    :alt: MIT License

.. image:: https://readthedocs.org/projects/twittersearch/badge/?version=latest
     :target: https://twittersearch.readthedocs.org/en/latest/
     :alt: Documentation

This library allows you easily create a search through the Twitter  API without having to know too much about the API details. Based on such a search you can even iterate throughout all tweets reachable via the Twitter Search API. There is an automatic reload of the next pages while using the iteration. TwitterSearch was developed as part of an interdisciplinary project at the `Technische Universität München <http://www.tum.de/en/>`_.

Reasons to use TwitterSearch
############################

Well, because it can be quite annoying to always parse the search url together and a minor spelling mistake is sometimes hard to find. Not to mention the pain of getting the next page of the results. Why not centralize this process and concentrate on the more important parts of the project?

More than that, TwitterSearch is:

* pretty small (around 500 lines of code currently)
* pretty easy to use, even for beginners
* pretty good at giving you **all** available information (including meta information)
* pretty iterable without any need to manually reload more results from the API
* pretty wrong values of API arguments are to raise an exception. This is done before the API gets queried and therefore helps to avoid to reach Twitters' limitations by obviously wrong API calls
* pretty friendly to Python >= 2.7 **and** Python >= 3.2
* pretty pretty to look at :)

Installation
############

TwitterSearch is also available on pypi and therefore can be installed via ``pip install TwitterSearch`` or ``easy_install TwitterSearch``. If you'd like to work with bleeding edge versions you're free to clone the ``devel`` branch. A manual installation can be done doing by downloading or cloning the repository and running ``python setup.py install``.

Search Twitter
##############

Everybody knows how much work it is to study at a university. So why not take a small shortcut? So in this example we assume we would like to find out how to copy a doctorate thesis in Germany. Let's have a look what the Twitter users have to say about `Mr Guttenberg <http://www.bbc.co.uk/news/world-europe-12608083>`_.

.. code-block:: python

    from TwitterSearch import *
    try:
        tso = TwitterSearchOrder() # create a TwitterSearchOrder object
        tso.set_keywords(['Guttenberg', 'Doktorarbeit']) # let's define all words we would like to have a look for
        tso.set_language('de') # we want to see German tweets only
        tso.set_include_entities(False) # and don't give us all those entity information
        
        # it's about time to create a TwitterSearch object with our secret tokens
        ts = TwitterSearch(
            consumer_key = 'aaabbb',
            consumer_secret = 'cccddd',
            access_token = '111222',
            access_token_secret = '333444'
         )
        
         # this is where the fun actually starts :)
        for tweet in ts.search_tweets_iterable(tso):
            print( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) )
        
    except TwitterSearchException as e: # take care of all those ugly errors if there are some
        print(e)


The result will be a text looking similar to this one. But as you see unfortunately there is no idea hidden in those tweets how to get your doctorate thesis without any work. Damn it!

::

    @enricozero tweeted: RT @viehdeo: Archiv: Comedy-Video: Oliver Welke parodiert “Mogelbaron” Dr. Guttenbergs Doktorarbeit (Schummel-cum-laude Pla... http://t. ...
    @schlagworte tweeted: "Erst letztens habe ich in meiner Doktorarbeit Guttenberg zitiert." Blockflöte des Todes: http://t.co/pCzIn429
    @nkoni7 tweeted: Familien sind auch betroffen wenn schlechte Politik gemacht wird. Nicht nur wenn Guttenberg seine Doktorarbeit fälscht ! #absolutemehrheit

Access User Timelines
#####################

You're thinking that the global wisdom of Twitter is way too much for your needs? Well, let's query a timeline of a certain user than:

.. code-block:: python

    from TwitterSearch import *

    try:
        tuo = TwitterUserOrder('NeinQuarterly') # create a TwitterUserOrder

        # it's about time to create TwitterSearch object again
        ts = TwitterSearch(
            consumer_key = 'aaabbb',
            consumer_secret = 'cccddd',
            access_token = '111222',
            access_token_secret = '333444'
        )
        
        # start asking Twitter about the timeline
        for tweet in ts.search_tweets_iterable(tuo): 
            print( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) )

    except TwitterSearchException as e: # catch all those ugly errors
        print(e)

You may guess the resulting output, but here it is anyway:

::

    @NeinQuarterly tweeted: To make a long story short: Twitter.
    @NeinQuarterly tweeted: A German subordinating conjunction walks into a bar. Three hours later it's joined by a verb.
    @NeinQuarterly tweeted: Foucault walks into a bar. No one notices.
    @NeinQuarterly tweeted: If it's not deleted, probably wasn't worth writing.
    @NeinQuarterly tweeted: Trust me: German prepositions aren't laughing with you. They're laughing at you.
    @NeinQuarterly tweeted: Another beautiful day for cultural pessimism.
    @NeinQuarterly tweeted: Excuse me, sir. Your Zeitgeist has arrived.

Interested in some more details?
################################

If you'd like to get more information about how TwitterSearch works internally and how to use it with all it's possibilities have a look at the `latest documentation <https://twittersearch.readthedocs.org/en/latest/>`_. A `changelog <https://github.com/ckoepp/TwitterSearch/blob/master/CHANGELOG.rst>`_ is also available within this repository.

Updating to 1.0.0 and newer
###########################

If you're upgrading from a version **< 1.0.0** be aware that the API changed! As part of the process to obtain `PEP-8 <http://legacy.python.org/dev/peps/pep-0008/>`_ compatibility all methods had to be renamed. The code changes to support the PEP-8 naming scheme are trivial. Just change the old method naming scheme from ``setKeywords(...)`` to the new one of ``set_keywords(...)``.

Apart from this issue, four other API changes were introduced with version 1.0.0:

* simplified proxy functionality (no usage of dicts but plain strings as only HTTPS proxies can be supported anyway)
* simplified geo-code parameter (``TwitterSearchOrder.set_geocode(...,metric=True)`` renamed to ``set_geocode(...,imperial_metric=True)``)
* simplified ``TwitterSearch.get_statistics()`` from dict to tuple style (``{'queries':<int>, 'tweets':<int>}`` to ``(<int>,<int>)``)
* additional feature: timelines of users can now be accessed using the new class ``TwitterUserOrder``

In total those changes can be done quickly without browsing the documentation.

If you're unable apply those changes, you might consider using TwitterSearch versions < 1.0.0. Those will stay available through pypi and therefore will be installable in the future using the common installation methods like ``pip install -I TwitterSearch==0.78.6``. Using the `release tags <https://github.com/ckoepp/TwitterSearch/releases>`_ is another easy way to navigate through all versions of this library.

License (MIT)
#############

Copyright (C) 2013 Christian Koepp

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

%package -n python3-TwitterSearch
Summary:	A library to easily iterate tweets found by the Twitter API
Provides:	python-TwitterSearch
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-TwitterSearch
*************
TwitterSearch
*************

.. image:: https://img.shields.io/travis/ckoepp/TwitterSearch/master.svg?style=flat-square
    :target: http://travis-ci.org/ckoepp/TwitterSearch/branches
    :alt: Build Status

.. image:: https://img.shields.io/coveralls/ckoepp/TwitterSearch.svg?style=flat-square
    :target: https://coveralls.io/r/ckoepp/TwitterSearch?branch=master
    :alt: Coverage
    
.. image:: https://landscape.io/github/ckoepp/TwitterSearch/master/landscape.svg?style=flat-square
    :target: https://landscape.io/github/ckoepp/TwitterSearch/master
    :alt: Code Health

.. image:: https://img.shields.io/pypi/v/TwitterSearch.svg?style=flat-square
    :target: https://pypi.python.org/pypi/TwitterSearch/
    :alt: PyPi version
	
.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
    :target: https://raw.githubusercontent.com/ckoepp/TwitterSearch/master/LICENSE
    :alt: MIT License

.. image:: https://readthedocs.org/projects/twittersearch/badge/?version=latest
     :target: https://twittersearch.readthedocs.org/en/latest/
     :alt: Documentation

This library allows you easily create a search through the Twitter  API without having to know too much about the API details. Based on such a search you can even iterate throughout all tweets reachable via the Twitter Search API. There is an automatic reload of the next pages while using the iteration. TwitterSearch was developed as part of an interdisciplinary project at the `Technische Universität München <http://www.tum.de/en/>`_.

Reasons to use TwitterSearch
############################

Well, because it can be quite annoying to always parse the search url together and a minor spelling mistake is sometimes hard to find. Not to mention the pain of getting the next page of the results. Why not centralize this process and concentrate on the more important parts of the project?

More than that, TwitterSearch is:

* pretty small (around 500 lines of code currently)
* pretty easy to use, even for beginners
* pretty good at giving you **all** available information (including meta information)
* pretty iterable without any need to manually reload more results from the API
* pretty wrong values of API arguments are to raise an exception. This is done before the API gets queried and therefore helps to avoid to reach Twitters' limitations by obviously wrong API calls
* pretty friendly to Python >= 2.7 **and** Python >= 3.2
* pretty pretty to look at :)

Installation
############

TwitterSearch is also available on pypi and therefore can be installed via ``pip install TwitterSearch`` or ``easy_install TwitterSearch``. If you'd like to work with bleeding edge versions you're free to clone the ``devel`` branch. A manual installation can be done doing by downloading or cloning the repository and running ``python setup.py install``.

Search Twitter
##############

Everybody knows how much work it is to study at a university. So why not take a small shortcut? So in this example we assume we would like to find out how to copy a doctorate thesis in Germany. Let's have a look what the Twitter users have to say about `Mr Guttenberg <http://www.bbc.co.uk/news/world-europe-12608083>`_.

.. code-block:: python

    from TwitterSearch import *
    try:
        tso = TwitterSearchOrder() # create a TwitterSearchOrder object
        tso.set_keywords(['Guttenberg', 'Doktorarbeit']) # let's define all words we would like to have a look for
        tso.set_language('de') # we want to see German tweets only
        tso.set_include_entities(False) # and don't give us all those entity information
        
        # it's about time to create a TwitterSearch object with our secret tokens
        ts = TwitterSearch(
            consumer_key = 'aaabbb',
            consumer_secret = 'cccddd',
            access_token = '111222',
            access_token_secret = '333444'
         )
        
         # this is where the fun actually starts :)
        for tweet in ts.search_tweets_iterable(tso):
            print( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) )
        
    except TwitterSearchException as e: # take care of all those ugly errors if there are some
        print(e)


The result will be a text looking similar to this one. But as you see unfortunately there is no idea hidden in those tweets how to get your doctorate thesis without any work. Damn it!

::

    @enricozero tweeted: RT @viehdeo: Archiv: Comedy-Video: Oliver Welke parodiert “Mogelbaron” Dr. Guttenbergs Doktorarbeit (Schummel-cum-laude Pla... http://t. ...
    @schlagworte tweeted: "Erst letztens habe ich in meiner Doktorarbeit Guttenberg zitiert." Blockflöte des Todes: http://t.co/pCzIn429
    @nkoni7 tweeted: Familien sind auch betroffen wenn schlechte Politik gemacht wird. Nicht nur wenn Guttenberg seine Doktorarbeit fälscht ! #absolutemehrheit

Access User Timelines
#####################

You're thinking that the global wisdom of Twitter is way too much for your needs? Well, let's query a timeline of a certain user than:

.. code-block:: python

    from TwitterSearch import *

    try:
        tuo = TwitterUserOrder('NeinQuarterly') # create a TwitterUserOrder

        # it's about time to create TwitterSearch object again
        ts = TwitterSearch(
            consumer_key = 'aaabbb',
            consumer_secret = 'cccddd',
            access_token = '111222',
            access_token_secret = '333444'
        )
        
        # start asking Twitter about the timeline
        for tweet in ts.search_tweets_iterable(tuo): 
            print( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) )

    except TwitterSearchException as e: # catch all those ugly errors
        print(e)

You may guess the resulting output, but here it is anyway:

::

    @NeinQuarterly tweeted: To make a long story short: Twitter.
    @NeinQuarterly tweeted: A German subordinating conjunction walks into a bar. Three hours later it's joined by a verb.
    @NeinQuarterly tweeted: Foucault walks into a bar. No one notices.
    @NeinQuarterly tweeted: If it's not deleted, probably wasn't worth writing.
    @NeinQuarterly tweeted: Trust me: German prepositions aren't laughing with you. They're laughing at you.
    @NeinQuarterly tweeted: Another beautiful day for cultural pessimism.
    @NeinQuarterly tweeted: Excuse me, sir. Your Zeitgeist has arrived.

Interested in some more details?
################################

If you'd like to get more information about how TwitterSearch works internally and how to use it with all it's possibilities have a look at the `latest documentation <https://twittersearch.readthedocs.org/en/latest/>`_. A `changelog <https://github.com/ckoepp/TwitterSearch/blob/master/CHANGELOG.rst>`_ is also available within this repository.

Updating to 1.0.0 and newer
###########################

If you're upgrading from a version **< 1.0.0** be aware that the API changed! As part of the process to obtain `PEP-8 <http://legacy.python.org/dev/peps/pep-0008/>`_ compatibility all methods had to be renamed. The code changes to support the PEP-8 naming scheme are trivial. Just change the old method naming scheme from ``setKeywords(...)`` to the new one of ``set_keywords(...)``.

Apart from this issue, four other API changes were introduced with version 1.0.0:

* simplified proxy functionality (no usage of dicts but plain strings as only HTTPS proxies can be supported anyway)
* simplified geo-code parameter (``TwitterSearchOrder.set_geocode(...,metric=True)`` renamed to ``set_geocode(...,imperial_metric=True)``)
* simplified ``TwitterSearch.get_statistics()`` from dict to tuple style (``{'queries':<int>, 'tweets':<int>}`` to ``(<int>,<int>)``)
* additional feature: timelines of users can now be accessed using the new class ``TwitterUserOrder``

In total those changes can be done quickly without browsing the documentation.

If you're unable apply those changes, you might consider using TwitterSearch versions < 1.0.0. Those will stay available through pypi and therefore will be installable in the future using the common installation methods like ``pip install -I TwitterSearch==0.78.6``. Using the `release tags <https://github.com/ckoepp/TwitterSearch/releases>`_ is another easy way to navigate through all versions of this library.

License (MIT)
#############

Copyright (C) 2013 Christian Koepp

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

%package help
Summary:	Development documents and examples for TwitterSearch
Provides:	python3-TwitterSearch-doc
%description help
*************
TwitterSearch
*************

.. image:: https://img.shields.io/travis/ckoepp/TwitterSearch/master.svg?style=flat-square
    :target: http://travis-ci.org/ckoepp/TwitterSearch/branches
    :alt: Build Status

.. image:: https://img.shields.io/coveralls/ckoepp/TwitterSearch.svg?style=flat-square
    :target: https://coveralls.io/r/ckoepp/TwitterSearch?branch=master
    :alt: Coverage
    
.. image:: https://landscape.io/github/ckoepp/TwitterSearch/master/landscape.svg?style=flat-square
    :target: https://landscape.io/github/ckoepp/TwitterSearch/master
    :alt: Code Health

.. image:: https://img.shields.io/pypi/v/TwitterSearch.svg?style=flat-square
    :target: https://pypi.python.org/pypi/TwitterSearch/
    :alt: PyPi version
	
.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
    :target: https://raw.githubusercontent.com/ckoepp/TwitterSearch/master/LICENSE
    :alt: MIT License

.. image:: https://readthedocs.org/projects/twittersearch/badge/?version=latest
     :target: https://twittersearch.readthedocs.org/en/latest/
     :alt: Documentation

This library allows you easily create a search through the Twitter  API without having to know too much about the API details. Based on such a search you can even iterate throughout all tweets reachable via the Twitter Search API. There is an automatic reload of the next pages while using the iteration. TwitterSearch was developed as part of an interdisciplinary project at the `Technische Universität München <http://www.tum.de/en/>`_.

Reasons to use TwitterSearch
############################

Well, because it can be quite annoying to always parse the search url together and a minor spelling mistake is sometimes hard to find. Not to mention the pain of getting the next page of the results. Why not centralize this process and concentrate on the more important parts of the project?

More than that, TwitterSearch is:

* pretty small (around 500 lines of code currently)
* pretty easy to use, even for beginners
* pretty good at giving you **all** available information (including meta information)
* pretty iterable without any need to manually reload more results from the API
* pretty wrong values of API arguments are to raise an exception. This is done before the API gets queried and therefore helps to avoid to reach Twitters' limitations by obviously wrong API calls
* pretty friendly to Python >= 2.7 **and** Python >= 3.2
* pretty pretty to look at :)

Installation
############

TwitterSearch is also available on pypi and therefore can be installed via ``pip install TwitterSearch`` or ``easy_install TwitterSearch``. If you'd like to work with bleeding edge versions you're free to clone the ``devel`` branch. A manual installation can be done doing by downloading or cloning the repository and running ``python setup.py install``.

Search Twitter
##############

Everybody knows how much work it is to study at a university. So why not take a small shortcut? So in this example we assume we would like to find out how to copy a doctorate thesis in Germany. Let's have a look what the Twitter users have to say about `Mr Guttenberg <http://www.bbc.co.uk/news/world-europe-12608083>`_.

.. code-block:: python

    from TwitterSearch import *
    try:
        tso = TwitterSearchOrder() # create a TwitterSearchOrder object
        tso.set_keywords(['Guttenberg', 'Doktorarbeit']) # let's define all words we would like to have a look for
        tso.set_language('de') # we want to see German tweets only
        tso.set_include_entities(False) # and don't give us all those entity information
        
        # it's about time to create a TwitterSearch object with our secret tokens
        ts = TwitterSearch(
            consumer_key = 'aaabbb',
            consumer_secret = 'cccddd',
            access_token = '111222',
            access_token_secret = '333444'
         )
        
         # this is where the fun actually starts :)
        for tweet in ts.search_tweets_iterable(tso):
            print( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) )
        
    except TwitterSearchException as e: # take care of all those ugly errors if there are some
        print(e)


The result will be a text looking similar to this one. But as you see unfortunately there is no idea hidden in those tweets how to get your doctorate thesis without any work. Damn it!

::

    @enricozero tweeted: RT @viehdeo: Archiv: Comedy-Video: Oliver Welke parodiert “Mogelbaron” Dr. Guttenbergs Doktorarbeit (Schummel-cum-laude Pla... http://t. ...
    @schlagworte tweeted: "Erst letztens habe ich in meiner Doktorarbeit Guttenberg zitiert." Blockflöte des Todes: http://t.co/pCzIn429
    @nkoni7 tweeted: Familien sind auch betroffen wenn schlechte Politik gemacht wird. Nicht nur wenn Guttenberg seine Doktorarbeit fälscht ! #absolutemehrheit

Access User Timelines
#####################

You're thinking that the global wisdom of Twitter is way too much for your needs? Well, let's query a timeline of a certain user than:

.. code-block:: python

    from TwitterSearch import *

    try:
        tuo = TwitterUserOrder('NeinQuarterly') # create a TwitterUserOrder

        # it's about time to create TwitterSearch object again
        ts = TwitterSearch(
            consumer_key = 'aaabbb',
            consumer_secret = 'cccddd',
            access_token = '111222',
            access_token_secret = '333444'
        )
        
        # start asking Twitter about the timeline
        for tweet in ts.search_tweets_iterable(tuo): 
            print( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) )

    except TwitterSearchException as e: # catch all those ugly errors
        print(e)

You may guess the resulting output, but here it is anyway:

::

    @NeinQuarterly tweeted: To make a long story short: Twitter.
    @NeinQuarterly tweeted: A German subordinating conjunction walks into a bar. Three hours later it's joined by a verb.
    @NeinQuarterly tweeted: Foucault walks into a bar. No one notices.
    @NeinQuarterly tweeted: If it's not deleted, probably wasn't worth writing.
    @NeinQuarterly tweeted: Trust me: German prepositions aren't laughing with you. They're laughing at you.
    @NeinQuarterly tweeted: Another beautiful day for cultural pessimism.
    @NeinQuarterly tweeted: Excuse me, sir. Your Zeitgeist has arrived.

Interested in some more details?
################################

If you'd like to get more information about how TwitterSearch works internally and how to use it with all it's possibilities have a look at the `latest documentation <https://twittersearch.readthedocs.org/en/latest/>`_. A `changelog <https://github.com/ckoepp/TwitterSearch/blob/master/CHANGELOG.rst>`_ is also available within this repository.

Updating to 1.0.0 and newer
###########################

If you're upgrading from a version **< 1.0.0** be aware that the API changed! As part of the process to obtain `PEP-8 <http://legacy.python.org/dev/peps/pep-0008/>`_ compatibility all methods had to be renamed. The code changes to support the PEP-8 naming scheme are trivial. Just change the old method naming scheme from ``setKeywords(...)`` to the new one of ``set_keywords(...)``.

Apart from this issue, four other API changes were introduced with version 1.0.0:

* simplified proxy functionality (no usage of dicts but plain strings as only HTTPS proxies can be supported anyway)
* simplified geo-code parameter (``TwitterSearchOrder.set_geocode(...,metric=True)`` renamed to ``set_geocode(...,imperial_metric=True)``)
* simplified ``TwitterSearch.get_statistics()`` from dict to tuple style (``{'queries':<int>, 'tweets':<int>}`` to ``(<int>,<int>)``)
* additional feature: timelines of users can now be accessed using the new class ``TwitterUserOrder``

In total those changes can be done quickly without browsing the documentation.

If you're unable apply those changes, you might consider using TwitterSearch versions < 1.0.0. Those will stay available through pypi and therefore will be installable in the future using the common installation methods like ``pip install -I TwitterSearch==0.78.6``. Using the `release tags <https://github.com/ckoepp/TwitterSearch/releases>`_ is another easy way to navigate through all versions of this library.

License (MIT)
#############

Copyright (C) 2013 Christian Koepp

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

%prep
%autosetup -n TwitterSearch-1.0.2

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-TwitterSearch -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Tue Apr 25 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.2-1
- Package Spec generated