irahorecka / pycraigslist

Craigslist API wrapper
MIT License
41 stars 14 forks source link

Error with get_filters() #5

Closed usctzen closed 3 years ago

usctzen commented 3 years ago

From the beginning, I was using the following to get the filters.

import pycraigslist

print(pycraigslist.forsale.mca.get_filters())

I needed to verify my filters again and when I issued the command, it replied:

Traceback (most recent call last):
  File "C:\Users\mgpd\PycharmProjects\MOlivo\py_clist.py", line 3, in <module>
    print(pycraigslist.forsale.mca.get_filters())
TypeError: get_filters() missing 1 required positional argument: 'self'
irahorecka commented 3 years ago

Hello Marc, get_filters() is no longer a class method. I realized filter keys are written in the language of the craigslist site and thus require these spellings for them to work. Therefore site is required to get appropriate filters:

import pycraigslist

tokyo_autos = pycraigslist.forsale.cta(site="tokyo")
print(tokyo_autos.get_filters())

>>> {'query': '...', 'search_titles': 'True/False', 'has_image': 'True/False',
    'posted_today': 'True/False', 'bundle_duplicates': 'True/False',
    'search_distance': '...', 'zip_code': '...', 'min_price': '...', 'max_price': '...',
    'make_model': '...', 'min_year': '...', 'max_year': '...', 'min_miles': '...',
    'max_miles': '...', 'min_engine_displacement': '...', 'max_engine_displacement': '...',
    'condition': ['新品', 'ほぼ新品', '美品', '良品', '使用に問題なし', 'サルベージ'],
    'auto_cylinders': ['3気筒', '4気筒', '5気筒', '6気筒', '8気筒', '10気筒', '12気筒', 'その他'],
    'auto_drivetrain': ['前輪', '後輪', '4WD'],
    'auto_fuel_type': ['ガソリン', 'ディーゼル', 'ハイブリッド', '電気', 'その他'],
    'auto_paint': ['ブラック', 'ブルー', 'ブラウン', 'グリーン', 'グレー', 'オレンジ', 'パープル',
                   'レッド', 'シルバー', 'ホワイト', 'イエロー', 'カスタム'],
    'auto_size': ['コンパクト', 'フルサイズ', '中型', 'サブコンパクト'],
    'auto_title_status': ['クリーン', 'サルベージ', '再生', '部品のみ', '先取特権', '不明'],
    'auto_transmission': ['MT', 'AT', 'その他'],
    'auto_bodytype': ['バス', 'コンバーチブル', 'クーペ', 'ハッチバック', 'ミニバン', 'オフロード',
                      'ピックアップ', 'セダン', 'トラック', 'SUV', 'ワゴン', 'バン', 'その他'],
    'language': ['afrikaans', 'català', 'dansk', 'deutsch', 'english', 'español', 'suomi',
                 'français', 'italiano', 'nederlands', 'norsk', 'português', 'svenska',
                 'filipino', 'türkçe', '中文', 'العربية', '日本語', '한국말', 'русский',
                 'tiếng việt']}
usctzen commented 3 years ago

That makes sense. Thanks for the fast answer.

irahorecka commented 3 years ago

No problem - I'll close this issue for now. Thanks, Marc!

irahorecka commented 3 years ago

Hey Marc, just a heads up that a new version was released. v0.5.0 should show significant performance increase in .search and especially .search_detail. Let me know if issues pop up. Thanks!

usctzen commented 3 years ago

Ira,

Will look into it and let you know. Thanks for the awesome work you do.

Marc

Le 9 mai 2021 à 20:22, Ira Horecka @.***> a écrit :

 Hey Marc, just a heads up that a new version was released. v0.5.0 should show significant performance increase in .search and especially .search_detail. Let me know if issues pop up. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.