A simple API to traverse Craigslist endpoints
Project description
Streamline your Craigslist queries with an API that traverses url endpoints. This library goes hand-in-hand with python-craigslist.
Installation
pip install python-craigslist-meta
Examples
Find cars and trucks for sale from around the world. (Note: you must have python-craigslist installed for this example)
from craigslist import CraigslistForSale
from craigslist_meta import Site
for site in Site.all():
if site.has_area():
for area in site:
auto = CraigslistForSale(site=site.key(), area=area.key(), category='cta')
# fetch posts from auto
else:
auto = CraigslistForSale(site=site.key(), category='cta')
# fetch posts from auto
Let’s get titles and urls from areas in the San Francisco Bay Area.
from craigslist_meta import Site
sfbay = Site("sfbay")
for area in sfbay:
print(area.title(), "|", area.url())
# East Bay Area | https://sfbay.craigslist.org/eby/
# North Bay / Marin | https://sfbay.craigslist.org/nby/
# Peninsula | https://sfbay.craigslist.org/pen/
# South Bay Area | https://sfbay.craigslist.org/sby/
# ...
We can also work with countries. Let’s find site urls in Germany.
from craigslist_meta import Country
germany = Country("germany")
for site in germany:
print(site.url())
# https://berlin.craigslist.org/
# https://bremen.craigslist.org/
# https://cologne.craigslist.org/
# https://dresden.craigslist.org/
# ...
Finally, let’s get url keys and titles from sites in Japan.
from craigslist_meta import Country
japan = Country("japan")
for site in japan:
print(site.key(), "|", site.title())
# fukuoka | 福岡
# hiroshima | 広島
# nagoya | 名古屋
# okinawa | 沖縄
# ...
Contribute
Support
If you are having issues or would like to propose a new feature, please use the issues tracker.
License
The project is licensed under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for python-craigslist-meta-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22f0518cf76514504fba787993d9eae0d5d4010b48d2c0d1d3e8569dfc878fae |
|
MD5 | 4a19e3b844ec2c2a1f21304e05f1ac11 |
|
BLAKE2b-256 | 7a2b3b8f6aff750cc8c610ad77b08fd133d8a9437e347c8ba08e3d0858680422 |
Close
Hashes for python_craigslist_meta-0.1.3-py3.8.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e1419b3dd6611ee22b3c7ee9c75eb6136474f0bca774b9db927186199246f4e |
|
MD5 | a35f3da7fd39109557a419f4903898e0 |
|
BLAKE2b-256 | 774401f57a6c544e1861587bd4ee5ff73db226c9e5134fd2de7cb9cd8f362f6e |