Person
Developer docs
A class to represent a person
Source code in src/whitepyges/person.py
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 |
|
__init__
Initialize a new Person object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
first_name | str | The first name of the person | required |
last_name | str | The last name of the person | required |
age | int | The age of the person. Defaults to None. | None |
city | str | The city of the person. Defaults to None. | None |
state | str | The state of the person. Defaults to None. | None |
zip_code | str | The zip code of the person. Defaults to None. | None |
Returns:
Type | Description |
---|---|
None | None |
Source code in src/whitepyges/person.py
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 |
|
__repr__
Return an unambiguous string representation of the Person object.
Returns:
Name | Type | Description |
---|---|---|
str | str | The unambiguous string representation of the Person object |
Source code in src/whitepyges/person.py
157 158 159 160 161 162 163 164 165 |
|
__str__
Return a readable string representation of the Person object.
Returns:
Name | Type | Description |
---|---|---|
str | str | The readable string representation of the Person object |
Source code in src/whitepyges/person.py
167 168 169 170 171 172 173 174 175 |
|
_clean_person_data
Clean the person data by filtering and repositioning the items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
person_data | dict | The raw person data. | required |
age | str | The age of the person. | required |
Returns:
Type | Description |
---|---|
list[dict] | list[dict]: The cleaned list of items. |
Source code in src/whitepyges/person.py
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 |
|
search
Perform a search for the person
Parameters:
Name | Type | Description | Default |
---|---|---|---|
count | int | The number of results to return. -1 returns all results. Defaults to -1. | -1 |
timeout | int | The timeout for the request. Defaults to 10. | 10 |
max_retries | int | The maximum number of retries. Defaults to 3. | 3 |
randomize_headers | bool | Randomize the headers for the request. Defaults to False. | False |
ignore_robots | bool | Ignore the robots.txt file. Defaults to False. | False |
Returns:
Type | Description |
---|---|
list[dict] | None | list[dict] | None: Possible data for the person |
Source code in src/whitepyges/person.py
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 |
|
Features
- Search for people by first name, last name, and state
- Returns names, profile URLs, addresses, phone numbers, and related people
- Handles request retries and optional header randomization
Example Usage
from whitepyges import Person
person: Person = Person(first_name='John', last_name='Doe', state='WA')
info: dict = person.search()
print(info)
Example Response
[
{
"name": "Jon Doe",
"givenName": "Jon",
"familyName": "Doe",
"description": "Jon Doe in their 70s, currently living in Example, WA",
"url": "https://www.whitepages.com/name/Jon-Doe/Example-WA/random_letters",
"address": [
{
"@type": "PostalAddress",
"streetAddress": "123 St",
"addressLocality": "Example",
"addressRegion": "WA",
"addressCountry": "US"
}
],
"telephone": "(123) 456-7890",
"relatedTo": []
},
{
"name": "Jon Doe",
"givenName": "Jon",
"familyName": "Doe",
"description": "Jon Doe in their 40s, currently living in Example-2, WA",
"url": "https://www.whitepages.com/name/Jon-Doe/Example-2-WA/random_letters2",
"address": [
{
"@type": "PostalAddress",
"streetAddress": "123 Ave",
"addressLocality": "Example-2",
"addressRegion": "WA",
"addressCountry": "US"
}
],
"telephone": "(123) 456-7890",
"relatedTo": []
}
]