Streamline your Craigslist queries with an API that traverses url endpoints. This library serves as an addition to pycraigslist and python-craigslist.
Installation
pip install python-craigslist-meta
Examples
Let’s find every car and truck for sale around the world. pycraigslist is required for this example.
import pycraigslist
from craigslist_meta import Site
for site in Site.all():
if site.has_area():
for area in site:
all_autos = pycraigslist.forsale.cta(site=site.key, area=area.key)
for auto in all_autos.search():
print(auto)
else:
all_autos = pycraigslist.forsale.cta(site=site.key)
for auto in all_autos.search():
print(auto)
We could run the same search using python-craigslist.
from craigslist import CraigslistForSale
from craigslist_meta import Site
for site in Site.all():
if site.has_area():
for area in site:
all_autos = CraigslistForSale(site=site.key, area=area.key, category='cta')
for auto in all_autos.get_results():
print(auto)
else:
all_autos = CraigslistForSale(site=site.key, category='cta')
for auto in all_autos.get_results():
print(auto)
Let’s get Craigslist urls of areas in the San Francisco Bay Area.
from craigslist_meta import Site
sfbay = Site("sfbay")
for area in sfbay:
print(area.url)
# https://sfbay.craigslist.org/eby/
# https://sfbay.craigslist.org/nby/
# https://sfbay.craigslist.org/pen/
# https://sfbay.craigslist.org/sby/
# ...
We can also work with countries. Let’s get site keys in Germany.
from craigslist_meta import Country
germany = Country("germany")
for site in germany:
print(site.key)
# berlin
# bremen
# cologne
# dresden
# ...
Let’s get titles of sites in Japan.
from craigslist_meta import Country
japan = Country("japan")
for site in japan:
print(site.title)
# 福岡
# 広島
# 名古屋
# 沖縄
# ...
Finally, we can go a step further and work with regions.
from craigslist_meta import Region
africa = Region("africa")
for country in africa:
print(country.title)
# Egypt
# Ethiopia
# Ghana
# Kenya
# ...
Get a list of valid keys for Region, Country, and Site by using the keys class attribute.
from craigslist_meta import Site
print(Site.keys)
# ['abbotsford', 'aberdeen', 'abilene', ... ]
from craigslist_meta import Country
india = Country("india")
# print site keys in India
print(india.children)
# ['ahmedabad', 'bangalore', 'bhubaneswar', ... ]
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.
Metadata
Release files for python-craigslist-meta 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python-craigslist-meta-0.5.1.tar.gz | 23.1 kB | Without provenance | Details |
Release files / python-craigslist-meta-0.5.1.tar.gz
| Download URL | python-craigslist-meta-0.5.1.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46a32e99c852180b17e35bdadf3ff86fd2497973f9f490759a3e79a8be1eccdc
|
|
BLAKE2b-256 checksum How to use checksums |
e36259fa1c5798e788617c131860e50f301b1618f0d69e57f1f21a164d485915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
|
Security for python-craigslist-meta 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.