|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from typing import Union, Optional |
| 4 | +from datetime import datetime |
| 5 | +from typing_extensions import Literal, TypeAlias |
| 6 | + |
| 7 | +from .._models import BaseModel |
| 8 | + |
| 9 | +__all__ = [ |
| 10 | + "ProxyCheckResponse", |
| 11 | + "Config", |
| 12 | + "ConfigDatacenterProxyConfig", |
| 13 | + "ConfigIspProxyConfig", |
| 14 | + "ConfigResidentialProxyConfig", |
| 15 | + "ConfigMobileProxyConfig", |
| 16 | + "ConfigCustomProxyConfig", |
| 17 | +] |
| 18 | + |
| 19 | + |
| 20 | +class ConfigDatacenterProxyConfig(BaseModel): |
| 21 | + """Configuration for a datacenter proxy.""" |
| 22 | + |
| 23 | + country: Optional[str] = None |
| 24 | + """ISO 3166 country code. Defaults to US if not provided.""" |
| 25 | + |
| 26 | + |
| 27 | +class ConfigIspProxyConfig(BaseModel): |
| 28 | + """Configuration for an ISP proxy.""" |
| 29 | + |
| 30 | + country: Optional[str] = None |
| 31 | + """ISO 3166 country code. Defaults to US if not provided.""" |
| 32 | + |
| 33 | + |
| 34 | +class ConfigResidentialProxyConfig(BaseModel): |
| 35 | + """Configuration for residential proxies.""" |
| 36 | + |
| 37 | + asn: Optional[str] = None |
| 38 | + """Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html""" |
| 39 | + |
| 40 | + city: Optional[str] = None |
| 41 | + """City name (no spaces, e.g. |
| 42 | +
|
| 43 | + `sanfrancisco`). If provided, `country` must also be provided. |
| 44 | + """ |
| 45 | + |
| 46 | + country: Optional[str] = None |
| 47 | + """ISO 3166 country code.""" |
| 48 | + |
| 49 | + os: Optional[Literal["windows", "macos", "android"]] = None |
| 50 | + """Operating system of the residential device.""" |
| 51 | + |
| 52 | + state: Optional[str] = None |
| 53 | + """Two-letter state code.""" |
| 54 | + |
| 55 | + zip: Optional[str] = None |
| 56 | + """US ZIP code.""" |
| 57 | + |
| 58 | + |
| 59 | +class ConfigMobileProxyConfig(BaseModel): |
| 60 | + """Configuration for mobile proxies.""" |
| 61 | + |
| 62 | + asn: Optional[str] = None |
| 63 | + """Autonomous system number. See https://bgp.potaroo.net/cidr/autnums.html""" |
| 64 | + |
| 65 | + carrier: Optional[ |
| 66 | + Literal[ |
| 67 | + "a1", |
| 68 | + "aircel", |
| 69 | + "airtel", |
| 70 | + "att", |
| 71 | + "celcom", |
| 72 | + "chinamobile", |
| 73 | + "claro", |
| 74 | + "comcast", |
| 75 | + "cox", |
| 76 | + "digi", |
| 77 | + "dt", |
| 78 | + "docomo", |
| 79 | + "dtac", |
| 80 | + "etisalat", |
| 81 | + "idea", |
| 82 | + "kyivstar", |
| 83 | + "meo", |
| 84 | + "megafon", |
| 85 | + "mtn", |
| 86 | + "mtnza", |
| 87 | + "mts", |
| 88 | + "optus", |
| 89 | + "orange", |
| 90 | + "qwest", |
| 91 | + "reliance_jio", |
| 92 | + "robi", |
| 93 | + "sprint", |
| 94 | + "telefonica", |
| 95 | + "telstra", |
| 96 | + "tmobile", |
| 97 | + "tigo", |
| 98 | + "tim", |
| 99 | + "verizon", |
| 100 | + "vimpelcom", |
| 101 | + "vodacomza", |
| 102 | + "vodafone", |
| 103 | + "vivo", |
| 104 | + "zain", |
| 105 | + "vivabo", |
| 106 | + "telenormyanmar", |
| 107 | + "kcelljsc", |
| 108 | + "swisscom", |
| 109 | + "singtel", |
| 110 | + "asiacell", |
| 111 | + "windit", |
| 112 | + "cellc", |
| 113 | + "ooredoo", |
| 114 | + "drei", |
| 115 | + "umobile", |
| 116 | + "cableone", |
| 117 | + "proximus", |
| 118 | + "tele2", |
| 119 | + "mobitel", |
| 120 | + "o2", |
| 121 | + "bouygues", |
| 122 | + "free", |
| 123 | + "sfr", |
| 124 | + "digicel", |
| 125 | + ] |
| 126 | + ] = None |
| 127 | + """Mobile carrier.""" |
| 128 | + |
| 129 | + city: Optional[str] = None |
| 130 | + """City name (no spaces, e.g. |
| 131 | +
|
| 132 | + `sanfrancisco`). If provided, `country` must also be provided. |
| 133 | + """ |
| 134 | + |
| 135 | + country: Optional[str] = None |
| 136 | + """ISO 3166 country code""" |
| 137 | + |
| 138 | + state: Optional[str] = None |
| 139 | + """Two-letter state code.""" |
| 140 | + |
| 141 | + zip: Optional[str] = None |
| 142 | + """US ZIP code.""" |
| 143 | + |
| 144 | + |
| 145 | +class ConfigCustomProxyConfig(BaseModel): |
| 146 | + """Configuration for a custom proxy (e.g., private proxy server).""" |
| 147 | + |
| 148 | + host: str |
| 149 | + """Proxy host address or IP.""" |
| 150 | + |
| 151 | + port: int |
| 152 | + """Proxy port.""" |
| 153 | + |
| 154 | + has_password: Optional[bool] = None |
| 155 | + """Whether the proxy has a password.""" |
| 156 | + |
| 157 | + username: Optional[str] = None |
| 158 | + """Username for proxy authentication.""" |
| 159 | + |
| 160 | + |
| 161 | +Config: TypeAlias = Union[ |
| 162 | + ConfigDatacenterProxyConfig, |
| 163 | + ConfigIspProxyConfig, |
| 164 | + ConfigResidentialProxyConfig, |
| 165 | + ConfigMobileProxyConfig, |
| 166 | + ConfigCustomProxyConfig, |
| 167 | +] |
| 168 | + |
| 169 | + |
| 170 | +class ProxyCheckResponse(BaseModel): |
| 171 | + """Configuration for routing traffic through a proxy.""" |
| 172 | + |
| 173 | + type: Literal["datacenter", "isp", "residential", "mobile", "custom"] |
| 174 | + """Proxy type to use. |
| 175 | +
|
| 176 | + In terms of quality for avoiding bot-detection, from best to worst: `mobile` > |
| 177 | + `residential` > `isp` > `datacenter`. |
| 178 | + """ |
| 179 | + |
| 180 | + id: Optional[str] = None |
| 181 | + |
| 182 | + config: Optional[Config] = None |
| 183 | + """Configuration specific to the selected proxy `type`.""" |
| 184 | + |
| 185 | + last_checked: Optional[datetime] = None |
| 186 | + """Timestamp of the last health check performed on this proxy.""" |
| 187 | + |
| 188 | + name: Optional[str] = None |
| 189 | + """Readable name of the proxy.""" |
| 190 | + |
| 191 | + protocol: Optional[Literal["http", "https"]] = None |
| 192 | + """Protocol to use for the proxy connection.""" |
| 193 | + |
| 194 | + status: Optional[Literal["available", "unavailable"]] = None |
| 195 | + """Current health status of the proxy.""" |
0 commit comments