genkit 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- genkit/__init__.py +1 -0
- genkit/country_code.py +242 -0
- genkit/genkit.py +74 -0
- genkit-0.1.0.dist-info/LICENSE +25 -0
- genkit-0.1.0.dist-info/METADATA +375 -0
- genkit-0.1.0.dist-info/RECORD +8 -0
- genkit-0.1.0.dist-info/WHEEL +5 -0
- genkit-0.1.0.dist-info/top_level.txt +1 -0
genkit/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .genkit import GenKit
|
genkit/country_code.py
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
code = {
|
|
2
|
+
"AF": "+93", # Afghanistan
|
|
3
|
+
"AL": "+355", # Albania
|
|
4
|
+
"DZ": "+213", # Algeria
|
|
5
|
+
"AS": "+1-684", # American Samoa
|
|
6
|
+
"AD": "+376", # Andorra
|
|
7
|
+
"AO": "+244", # Angola
|
|
8
|
+
"AI": "+1-264", # Anguilla
|
|
9
|
+
"AQ": "+672", # Antarctica
|
|
10
|
+
"AG": "+1-268", # Antigua and Barbuda
|
|
11
|
+
"AR": "+54", # Argentina
|
|
12
|
+
"AM": "+374", # Armenia
|
|
13
|
+
"AW": "+297", # Aruba
|
|
14
|
+
"AU": "+61", # Australia
|
|
15
|
+
"AT": "+43", # Austria
|
|
16
|
+
"AZ": "+994", # Azerbaijan
|
|
17
|
+
"BS": "+1-242", # Bahamas
|
|
18
|
+
"BH": "+973", # Bahrain
|
|
19
|
+
"BD": "+880", # Bangladesh
|
|
20
|
+
"BB": "+1-246", # Barbados
|
|
21
|
+
"BY": "+375", # Belarus
|
|
22
|
+
"BE": "+32", # Belgium
|
|
23
|
+
"BZ": "+501", # Belize
|
|
24
|
+
"BJ": "+229", # Benin
|
|
25
|
+
"BM": "+1-441", # Bermuda
|
|
26
|
+
"BT": "+975", # Bhutan
|
|
27
|
+
"BO": "+591", # Bolivia
|
|
28
|
+
"BA": "+387", # Bosnia and Herzegovina
|
|
29
|
+
"BW": "+267", # Botswana
|
|
30
|
+
"BV": "+47", # Bouvet Island
|
|
31
|
+
"BR": "+55", # Brazil
|
|
32
|
+
"IO": "+246", # British Indian Ocean Territory
|
|
33
|
+
"BN": "+673", # Brunei
|
|
34
|
+
"BG": "+359", # Bulgaria
|
|
35
|
+
"BF": "+226", # Burkina Faso
|
|
36
|
+
"KH": "+855", # Cambodia
|
|
37
|
+
"CM": "+237", # Cameroon
|
|
38
|
+
"CA": "+1", # Canada
|
|
39
|
+
"CV": "+238", # Cape Verde
|
|
40
|
+
"KY": "+1-345", # Cayman Islands
|
|
41
|
+
"CF": "+236", # Central African Republic
|
|
42
|
+
"TD": "+235", # Chad
|
|
43
|
+
"CL": "+56", # Chile
|
|
44
|
+
"CN": "+86", # China
|
|
45
|
+
"CX": "+61", # Christmas Island
|
|
46
|
+
"CC": "+61", # Cocos (Keeling) Islands
|
|
47
|
+
"CO": "+57", # Colombia
|
|
48
|
+
"KM": "+269", # Comoros
|
|
49
|
+
"CD": "+243", # Congo, Democratic Republic of the
|
|
50
|
+
"CG": "+242", # Congo, Republic of the
|
|
51
|
+
"CK": "+682", # Cook Islands
|
|
52
|
+
"CR": "+506", # Costa Rica
|
|
53
|
+
"CI": "+225", # Cote D'Ivoire
|
|
54
|
+
"HR": "+385", # Croatia
|
|
55
|
+
"CU": "+53", # Cuba
|
|
56
|
+
"CY": "+357", # Cyprus
|
|
57
|
+
"CZ": "+420", # Czech Republic
|
|
58
|
+
"CS": "+42", # Czechoslovakia
|
|
59
|
+
"DK": "+45", # Denmark
|
|
60
|
+
"DJ": "+253", # Djibouti
|
|
61
|
+
"DM": "+1-767", # Dominica
|
|
62
|
+
"DO": "+1-809", # Dominican Republic
|
|
63
|
+
"TP": "+670", # East Timor
|
|
64
|
+
"EC": "+593", # Ecuador
|
|
65
|
+
"EG": "+20", # Egypt
|
|
66
|
+
"SV": "+503", # El Salvador
|
|
67
|
+
"GQ": "+240", # Equatorial Guinea
|
|
68
|
+
"ER": "+291", # Eritrea
|
|
69
|
+
"EE": "+372", # Estonia
|
|
70
|
+
"ET": "+251", # Ethiopia
|
|
71
|
+
"FK": "+500", # Falkland Islands
|
|
72
|
+
"FO": "+298", # Faroe Islands
|
|
73
|
+
"FJ": "+679", # Fiji
|
|
74
|
+
"FI": "+358", # Finland
|
|
75
|
+
"FR": "+33", # France
|
|
76
|
+
"GF": "+594", # French Guiana
|
|
77
|
+
"PF": "+689", # French Polynesia
|
|
78
|
+
"TF": "+262", # French Southern Territories
|
|
79
|
+
"GA": "+241", # Gabon
|
|
80
|
+
"GM": "+220", # Gambia
|
|
81
|
+
"GE": "+995", # Georgia
|
|
82
|
+
"DE": "+49", # Germany
|
|
83
|
+
"GH": "+233", # Ghana
|
|
84
|
+
"GI": "+350", # Gibraltar
|
|
85
|
+
"GB": "+44", # United Kingdom
|
|
86
|
+
"GR": "+30", # Greece
|
|
87
|
+
"GL": "+299", # Greenland
|
|
88
|
+
"GD": "+1-473", # Grenada
|
|
89
|
+
"GP": "+590", # Guadeloupe
|
|
90
|
+
"GU": "+1-671", # Guam
|
|
91
|
+
"GT": "+502", # Guatemala
|
|
92
|
+
"GN": "+224", # Guinea
|
|
93
|
+
"GW": "+245", # Guinea-Bissau
|
|
94
|
+
"GY": "+592", # Guyana
|
|
95
|
+
"HT": "+509", # Haiti
|
|
96
|
+
"HM": "+672", # Heard Island and McDonald Islands
|
|
97
|
+
"VA": "+39", # Holy See (Vatican City State)
|
|
98
|
+
"HN": "+504", # Honduras
|
|
99
|
+
"HK": "+852", # Hong Kong
|
|
100
|
+
"HU": "+36", # Hungary
|
|
101
|
+
"IS": "+354", # Iceland
|
|
102
|
+
"IN": "+91", # India
|
|
103
|
+
"ID": "+62", # Indonesia
|
|
104
|
+
"IR": "+98", # Iran
|
|
105
|
+
"IQ": "+964", # Iraq
|
|
106
|
+
"IE": "+353", # Ireland
|
|
107
|
+
"IL": "+972", # Israel
|
|
108
|
+
"IT": "+39", # Italy
|
|
109
|
+
"JM": "+1-876", # Jamaica
|
|
110
|
+
"JP": "+81", # Japan
|
|
111
|
+
"JO": "+962", # Jordan
|
|
112
|
+
"KZ": "+7", # Kazakhstan
|
|
113
|
+
"KE": "+254", # Kenya
|
|
114
|
+
"KI": "+686", # Kiribati
|
|
115
|
+
"KP": "+850", # North Korea
|
|
116
|
+
"KR": "+82", # South Korea
|
|
117
|
+
"KW": "+965", # Kuwait
|
|
118
|
+
"KG": "+996", # Kyrgyzstan
|
|
119
|
+
"LA": "+856", # Laos
|
|
120
|
+
"LV": "+371", # Latvia
|
|
121
|
+
"LB": "+961", # Lebanon
|
|
122
|
+
"LS": "+266", # Lesotho
|
|
123
|
+
"LR": "+231", # Liberia
|
|
124
|
+
"LY": "+218", # Libya
|
|
125
|
+
"LI": "+423", # Liechtenstein
|
|
126
|
+
"LT": "+370", # Lithuania
|
|
127
|
+
"LU": "+352", # Luxembourg
|
|
128
|
+
"MO": "+853", # Macau
|
|
129
|
+
"MK": "+389", # North Macedonia
|
|
130
|
+
"MG": "+261", # Madagascar
|
|
131
|
+
"MW": "+265", # Malawi
|
|
132
|
+
"MY": "+60", # Malaysia
|
|
133
|
+
"MV": "+960", # Maldives
|
|
134
|
+
"ML": "+223", # Mali
|
|
135
|
+
"MT": "+356", # Malta
|
|
136
|
+
"MH": "+692", # Marshall Islands
|
|
137
|
+
"MQ": "+596", # Martinique
|
|
138
|
+
"MR": "+222", # Mauritania
|
|
139
|
+
"MU": "+230", # Mauritius
|
|
140
|
+
"YT": "+269", # Mayotte
|
|
141
|
+
"MX": "+52", # Mexico
|
|
142
|
+
"FM": "+691", # Micronesia
|
|
143
|
+
"MD": "+373", # Moldova
|
|
144
|
+
"MC": "+377", # Monaco
|
|
145
|
+
"MN": "+976", # Mongolia
|
|
146
|
+
"MS": "+1-664", # Montserrat
|
|
147
|
+
"MA": "+212", # Morocco
|
|
148
|
+
"MZ": "+258", # Mozambique
|
|
149
|
+
"MM": "+95", # Myanmar
|
|
150
|
+
"NA": "+264", # Namibia
|
|
151
|
+
"NR": "+674", # Nauru
|
|
152
|
+
"NP": "+977", # Nepal
|
|
153
|
+
"NL": "+31", # Netherlands
|
|
154
|
+
"AN": "+599", # Netherlands Antilles
|
|
155
|
+
"NC": "+687", # New Caledonia
|
|
156
|
+
"NZ": "+64", # New Zealand
|
|
157
|
+
"NI": "+505", # Nicaragua
|
|
158
|
+
"NE": "+227", # Niger
|
|
159
|
+
"NG": "+234", # Nigeria
|
|
160
|
+
"NU": "+683", # Niue
|
|
161
|
+
"NF": "+672", # Norfolk Island
|
|
162
|
+
"MP": "+1-670", # Northern Mariana Islands
|
|
163
|
+
"NO": "+47", # Norway
|
|
164
|
+
"OM": "+968", # Oman
|
|
165
|
+
"PK": "+92", # Pakistan
|
|
166
|
+
"PW": "+680", # Palau
|
|
167
|
+
"PS": "+970", # Palestine
|
|
168
|
+
"PA": "+507", # Panama
|
|
169
|
+
"PG": "+675", # Papua New Guinea
|
|
170
|
+
"PY": "+595", # Paraguay
|
|
171
|
+
"PE": "+51", # Peru
|
|
172
|
+
"PH": "+63", # Philippines
|
|
173
|
+
"PN": "+870", # Pitcairn
|
|
174
|
+
"PL": "+48", # Poland
|
|
175
|
+
"PT": "+351", # Portugal
|
|
176
|
+
"PR": "+1-787", # Puerto Rico
|
|
177
|
+
"QA": "+974", # Qatar
|
|
178
|
+
"RE": "+262", # Reunion
|
|
179
|
+
"RO": "+40", # Romania
|
|
180
|
+
"RU": "+7", # Russia
|
|
181
|
+
"RW": "+250", # Rwanda
|
|
182
|
+
"SH": "+290", # Saint Helena
|
|
183
|
+
"KN": "+1-869", # Saint Kitts and Nevis
|
|
184
|
+
"LC": "+1-758", # Saint Lucia
|
|
185
|
+
"PM": "+508", # Saint Pierre and Miquelon
|
|
186
|
+
"VC": "+1-784", # Saint Vincent and the Grenadines
|
|
187
|
+
"WS": "+685", # Samoa
|
|
188
|
+
"SM": "+378", # San Marino
|
|
189
|
+
"ST": "+239", # Sao Tome and Principe
|
|
190
|
+
"SA": "+966", # Saudi Arabia
|
|
191
|
+
"SN": "+221", # Senegal
|
|
192
|
+
"SC": "+248", # Seychelles
|
|
193
|
+
"SL": "+232", # Sierra Leone
|
|
194
|
+
"SG": "+65", # Singapore
|
|
195
|
+
"SX": "+1-721", # Sint Maarten
|
|
196
|
+
"SK": "+421", # Slovakia
|
|
197
|
+
"SI": "+386", # Slovenia
|
|
198
|
+
"SB": "+677", # Solomon Islands
|
|
199
|
+
"SO": "+252", # Somalia
|
|
200
|
+
"ZA": "+27", # South Africa
|
|
201
|
+
"SS": "+211", # South Sudan
|
|
202
|
+
"ES": "+34", # Spain
|
|
203
|
+
"LK": "+94", # Sri Lanka
|
|
204
|
+
"SD": "+249", # Sudan
|
|
205
|
+
"SR": "+597", # Suriname
|
|
206
|
+
"SJ": "+47", # Svalbard and Jan Mayen
|
|
207
|
+
"SZ": "+268", # Swaziland
|
|
208
|
+
"SE": "+46", # Sweden
|
|
209
|
+
"CH": "+41", # Switzerland
|
|
210
|
+
"SY": "+963", # Syria
|
|
211
|
+
"TW": "+886", # Taiwan
|
|
212
|
+
"TJ": "+992", # Tajikistan
|
|
213
|
+
"TZ": "+255", # Tanzania
|
|
214
|
+
"TH": "+66", # Thailand
|
|
215
|
+
"TL": "+670", # Timor-Leste
|
|
216
|
+
"TG": "+228", # Togo
|
|
217
|
+
"TK": "+690", # Tokelau
|
|
218
|
+
"TO": "+676", # Tonga
|
|
219
|
+
"TT": "+1-868", # Trinidad and Tobago
|
|
220
|
+
"TN": "+216", # Tunisia
|
|
221
|
+
"TR": "+90", # Turkey
|
|
222
|
+
"TM": "+993", # Turkmenistan
|
|
223
|
+
"TV": "+688", # Tuvalu
|
|
224
|
+
"UG": "+256", # Uganda
|
|
225
|
+
"UA": "+380", # Ukraine
|
|
226
|
+
"AE": "+971", # United Arab Emirates
|
|
227
|
+
"GB": "+44", # United Kingdom
|
|
228
|
+
"US": "+1", # United States
|
|
229
|
+
"UM": "+1", # United States Minor Outlying Islands
|
|
230
|
+
"UY": "+598", # Uruguay
|
|
231
|
+
"UZ": "+998", # Uzbekistan
|
|
232
|
+
"VU": "+678", # Vanuatu
|
|
233
|
+
"VE": "+58", # Venezuela
|
|
234
|
+
"VN": "+84", # Vietnam
|
|
235
|
+
"VG": "+1-284", # Virgin Islands (British)
|
|
236
|
+
"VI": "+1-340", # Virgin Islands (U.S.)
|
|
237
|
+
"WF": "+681", # Wallis and Futuna
|
|
238
|
+
"EH": "+212", # Western Sahara
|
|
239
|
+
"YE": "+967", # Yemen
|
|
240
|
+
"ZM": "+260", # Zambia
|
|
241
|
+
"ZW": "+263", # Zimbabwe
|
|
242
|
+
}
|
genkit/genkit.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
import random
|
|
3
|
+
import time
|
|
4
|
+
import json
|
|
5
|
+
from .country_code import code
|
|
6
|
+
class GenKit:
|
|
7
|
+
class PhoneGen:
|
|
8
|
+
def __init__(self, country="IN"):
|
|
9
|
+
"""
|
|
10
|
+
Initialize the PhoneGen class with a specific country code.
|
|
11
|
+
|
|
12
|
+
Parameters:
|
|
13
|
+
country (str): The country code to use for generating phone numbers.
|
|
14
|
+
Defaults to 'IN' for India.
|
|
15
|
+
"""
|
|
16
|
+
# Country codes based on the country
|
|
17
|
+
self.codes = code
|
|
18
|
+
# Set the country code or default to India
|
|
19
|
+
self.code = self.codes.get(country.upper(), "+91")
|
|
20
|
+
|
|
21
|
+
def generate(self, length=10):
|
|
22
|
+
"""
|
|
23
|
+
Generate a random phone number with the specified length.
|
|
24
|
+
|
|
25
|
+
Parameters:
|
|
26
|
+
length (int): The length of the phone number to generate. Defaults to 10.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
str: A phone number with the specified length and country code.
|
|
30
|
+
"""
|
|
31
|
+
if self.code == "+91":
|
|
32
|
+
# For Indian numbers, ensure the number starts with a digit between 6 and 9
|
|
33
|
+
number = str(random.randint(6, 9)) + ''.join([str(random.randint(0, 9)) for _ in range(length - 1)])
|
|
34
|
+
else:
|
|
35
|
+
# Generate a random phone number for other countries
|
|
36
|
+
number = ''.join([str(random.randint(0, 9)) for _ in range(length)])
|
|
37
|
+
|
|
38
|
+
return f"{self.code}{number}"
|
|
39
|
+
|
|
40
|
+
@staticmethod
|
|
41
|
+
def phonenumber(country="IN", n=1, type="string", save=False):
|
|
42
|
+
"""
|
|
43
|
+
Generate a specified number of phone numbers for a given country.
|
|
44
|
+
|
|
45
|
+
Parameters:
|
|
46
|
+
country (str): The country code to use for generating phone numbers. Defaults to 'IN'.
|
|
47
|
+
n (int): The number of phone numbers to generate. Defaults to 1.
|
|
48
|
+
type (str): The format of the output. Can be 'string' (default), 'list', or 'dict'.
|
|
49
|
+
save (bool): Whether to save the generated phone numbers to a file. Defaults to False.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
str | list | dict: The generated phone numbers in the specified format.
|
|
53
|
+
"""
|
|
54
|
+
phone_gen = GenKit.PhoneGen(country)
|
|
55
|
+
numbers = [phone_gen.generate() for _ in range(n)]
|
|
56
|
+
|
|
57
|
+
if type == "list":
|
|
58
|
+
result = numbers
|
|
59
|
+
elif type == "dict":
|
|
60
|
+
result = {"phone_numbers": numbers}
|
|
61
|
+
else: # default to "string"
|
|
62
|
+
result = "\n".join(numbers)
|
|
63
|
+
|
|
64
|
+
if save:
|
|
65
|
+
timestamp = int(time.time())
|
|
66
|
+
filename = f"genkit_{timestamp}.txt"
|
|
67
|
+
with open(filename, "w") as file:
|
|
68
|
+
if type == "dict":
|
|
69
|
+
json.dump(result, file, indent=4)
|
|
70
|
+
else:
|
|
71
|
+
file.write(result)
|
|
72
|
+
print(f"Data saved to file: {filename}")
|
|
73
|
+
|
|
74
|
+
return result
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
**5. `LICENSE`**
|
|
2
|
+
|
|
3
|
+
```markdown
|
|
4
|
+
MIT License
|
|
5
|
+
|
|
6
|
+
Copyright (c) [2024] [Suhail]
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
```
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: genkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python package for generating random data like phone numbers.
|
|
5
|
+
Home-page: UNKNOWN
|
|
6
|
+
Author: Suhail Shaji
|
|
7
|
+
Author-email: suhailshaji@gmail.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Keywords: random phone number generator,genkit,generate random phone number with country code
|
|
10
|
+
Platform: UNKNOWN
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.6
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
|
|
18
|
+
# GenKit
|
|
19
|
+
|
|
20
|
+
GenKit is a versatile Python package designed for generating various types of data. It includes functionality for generating phone numbers in different formats based on country codes. Whether you need a phone number for testing or other purposes, genkit simplifies the process by offering customizable options.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **Phone Number Generation** : Generate phone numbers in formats specific to various countries.
|
|
25
|
+
- **Customizable** : Specify the country to get the appropriate phone number format.
|
|
26
|
+
- **Easy Integration** : Seamlessly integrate into your Python projects.
|
|
27
|
+
- **File Saving**: Save generated data to text files with timestamps for easy tracking.
|
|
28
|
+
- **Flexible Formats**: Return data as a list, dictionary, or plain string based on user preference.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
You can easily install genkit using pip. Run the following command to install it:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
pip install genkit
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Generating a Single Phone Number
|
|
41
|
+
|
|
42
|
+
You can generate a single phone number for a specified country. By default, it generates an Indian phone number.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
from genkit import GenKit
|
|
46
|
+
|
|
47
|
+
# Generate a phone number for India (default)
|
|
48
|
+
print(GenKit.phonenumber())
|
|
49
|
+
|
|
50
|
+
# Generate a phone number for the US
|
|
51
|
+
print(GenKit.phonenumber("US"))
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Generating Multiple Phone Numbers
|
|
56
|
+
|
|
57
|
+
To generate multiple phone numbers, use the `n` parameter to specify the quantity. You can also specify the output format using the `type` parameter.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
from genkit import GenKit
|
|
61
|
+
|
|
62
|
+
# Generate 5 phone numbers for India and return as a list
|
|
63
|
+
print(GenKit.phonenumber("IN", n=5, type="list"))
|
|
64
|
+
|
|
65
|
+
# Generate 3 phone numbers for the US and return as a dictionary
|
|
66
|
+
print(GenKit.phonenumber("US", n=3, type="dict"))
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Saving to a File
|
|
70
|
+
|
|
71
|
+
You can save the generated phone numbers to a text file. The file will be named `genkit_TIMESTAMP.txt`, where `TIMESTAMP` is the current timestamp.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
from genkit import GenKit
|
|
75
|
+
|
|
76
|
+
# Generate 5 phone numbers for India and save to a file
|
|
77
|
+
GenKit.phonenumber("IN", n=5, save=True)
|
|
78
|
+
|
|
79
|
+
# Generate 3 phone numbers for the US in dictionary format and save to a file
|
|
80
|
+
GenKit.phonenumber("US", n=3, type="dict", save=True)
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Reference
|
|
85
|
+
|
|
86
|
+
Generates phone numbers based on the specified parameters.
|
|
87
|
+
|
|
88
|
+
##### Parameters:
|
|
89
|
+
|
|
90
|
+
* n (int): Number of phone numbers to generate. Default is 1.
|
|
91
|
+
* type (str): Output format. Can be "string" (default), "list", or "dict".
|
|
92
|
+
* save (bool): Whether to save the generated numbers to a file. Default is False.
|
|
93
|
+
|
|
94
|
+
##### **Returns:**
|
|
95
|
+
|
|
96
|
+
* If `type` is "string": A newline-separated string of phone numbers.
|
|
97
|
+
* If `type` is "list": A list of phone numbers.
|
|
98
|
+
* If `type` is "dict": A dictionary with a key "phone_numbers" containing the list of phone numbers.
|
|
99
|
+
|
|
100
|
+
### Example
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
result = GenKit.phonenumber("US", n=5, type="dict", save=True)
|
|
104
|
+
print(result) # Output: {'phone_numbers': ['+1XXXXXXXXXX', '+1XXXXXXXXXX', ...]}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Supported Countries
|
|
108
|
+
|
|
109
|
+
The following countries are supported for phone number generation. Use 2-digit ISO codes to generate:
|
|
110
|
+
|
|
111
|
+
| ISO Code | Country | Phone Code |
|
|
112
|
+
| -------- | -------------------------------------------- | ---------- |
|
|
113
|
+
| AF | Afghanistan | +93 |
|
|
114
|
+
| AL | Albania | +355 |
|
|
115
|
+
| DZ | Algeria | +213 |
|
|
116
|
+
| AS | American Samoa | +1-684 |
|
|
117
|
+
| AD | Andorra | +376 |
|
|
118
|
+
| AO | Angola | +244 |
|
|
119
|
+
| AI | Anguilla | +1-264 |
|
|
120
|
+
| AQ | Antarctica | +672 |
|
|
121
|
+
| AG | Antigua and Barbuda | +1-268 |
|
|
122
|
+
| AR | Argentina | +54 |
|
|
123
|
+
| AM | Armenia | +374 |
|
|
124
|
+
| AW | Aruba | +297 |
|
|
125
|
+
| AU | Australia | +61 |
|
|
126
|
+
| AT | Austria | +43 |
|
|
127
|
+
| AZ | Azerbaijan | +994 |
|
|
128
|
+
| BS | Bahamas | +1-242 |
|
|
129
|
+
| BH | Bahrain | +973 |
|
|
130
|
+
| BD | Bangladesh | +880 |
|
|
131
|
+
| BB | Barbados | +1-246 |
|
|
132
|
+
| BY | Belarus | +375 |
|
|
133
|
+
| BE | Belgium | +32 |
|
|
134
|
+
| BZ | Belize | +501 |
|
|
135
|
+
| BJ | Benin | +229 |
|
|
136
|
+
| BM | Bermuda | +1-441 |
|
|
137
|
+
| BT | Bhutan | +975 |
|
|
138
|
+
| BO | Bolivia | +591 |
|
|
139
|
+
| BA | Bosnia and Herzegovina | +387 |
|
|
140
|
+
| BW | Botswana | +267 |
|
|
141
|
+
| BV | Bouvet Island | +47 |
|
|
142
|
+
| BR | Brazil | +55 |
|
|
143
|
+
| IO | British Indian Ocean Territory | +246 |
|
|
144
|
+
| BN | Brunei | +673 |
|
|
145
|
+
| BG | Bulgaria | +359 |
|
|
146
|
+
| BF | Burkina Faso | +226 |
|
|
147
|
+
| KH | Cambodia | +855 |
|
|
148
|
+
| CM | Cameroon | +237 |
|
|
149
|
+
| CA | Canada | +1 |
|
|
150
|
+
| CV | Cape Verde | +238 |
|
|
151
|
+
| KY | Cayman Islands | +1-345 |
|
|
152
|
+
| CF | Central African Republic | +236 |
|
|
153
|
+
| TD | Chad | +235 |
|
|
154
|
+
| CL | Chile | +56 |
|
|
155
|
+
| CN | China | +86 |
|
|
156
|
+
| CX | Christmas Island | +61 |
|
|
157
|
+
| CC | Cocos (Keeling) Islands | +61 |
|
|
158
|
+
| CO | Colombia | +57 |
|
|
159
|
+
| KM | Comoros | +269 |
|
|
160
|
+
| CD | Congo, Democratic Republic of the | +243 |
|
|
161
|
+
| CG | Congo, Republic of the | +242 |
|
|
162
|
+
| CK | Cook Islands | +682 |
|
|
163
|
+
| CR | Costa Rica | +506 |
|
|
164
|
+
| CI | Cote D'Ivoire | +225 |
|
|
165
|
+
| HR | Croatia | +385 |
|
|
166
|
+
| CU | Cuba | +53 |
|
|
167
|
+
| CY | Cyprus | +357 |
|
|
168
|
+
| CZ | Czech Republic | +420 |
|
|
169
|
+
| CS | Czechoslovakia | +42 |
|
|
170
|
+
| DK | Denmark | +45 |
|
|
171
|
+
| DJ | Djibouti | +253 |
|
|
172
|
+
| DM | Dominica | +1-767 |
|
|
173
|
+
| DO | Dominican Republic | +1-809 |
|
|
174
|
+
| TP | East Timor | +670 |
|
|
175
|
+
| EC | Ecuador | +593 |
|
|
176
|
+
| EG | Egypt | +20 |
|
|
177
|
+
| SV | El Salvador | +503 |
|
|
178
|
+
| GQ | Equatorial Guinea | +240 |
|
|
179
|
+
| ER | Eritrea | +291 |
|
|
180
|
+
| EE | Estonia | +372 |
|
|
181
|
+
| ET | Ethiopia | +251 |
|
|
182
|
+
| FK | Falkland Islands | +500 |
|
|
183
|
+
| FO | Faroe Islands | +298 |
|
|
184
|
+
| FJ | Fiji | +679 |
|
|
185
|
+
| FI | Finland | +358 |
|
|
186
|
+
| FR | France | +33 |
|
|
187
|
+
| GF | French Guiana | +594 |
|
|
188
|
+
| PF | French Polynesia | +689 |
|
|
189
|
+
| TF | French Southern Territories | +262 |
|
|
190
|
+
| GA | Gabon | +241 |
|
|
191
|
+
| GM | Gambia | +220 |
|
|
192
|
+
| GE | Georgia | +995 |
|
|
193
|
+
| DE | Germany | +49 |
|
|
194
|
+
| GH | Ghana | +233 |
|
|
195
|
+
| GI | Gibraltar | +350 |
|
|
196
|
+
| GB | United Kingdom | +44 |
|
|
197
|
+
| GR | Greece | +30 |
|
|
198
|
+
| GL | Greenland | +299 |
|
|
199
|
+
| GD | Grenada | +1-473 |
|
|
200
|
+
| GP | Guadeloupe | +590 |
|
|
201
|
+
| GU | Guam | +1-671 |
|
|
202
|
+
| GT | Guatemala | +502 |
|
|
203
|
+
| GN | Guinea | +224 |
|
|
204
|
+
| GW | Guinea-Bissau | +245 |
|
|
205
|
+
| GY | Guyana | +592 |
|
|
206
|
+
| HT | Haiti | +509 |
|
|
207
|
+
| HM | Heard Island and McDonald Islands | +672 |
|
|
208
|
+
| VA | Holy See (Vatican City State) | +39 |
|
|
209
|
+
| HN | Honduras | +504 |
|
|
210
|
+
| HK | Hong Kong | +852 |
|
|
211
|
+
| HU | Hungary | +36 |
|
|
212
|
+
| IS | Iceland | +354 |
|
|
213
|
+
| IN | India | +91 |
|
|
214
|
+
| ID | Indonesia | +62 |
|
|
215
|
+
| IR | Iran | +98 |
|
|
216
|
+
| IQ | Iraq | +964 |
|
|
217
|
+
| IE | Ireland | +353 |
|
|
218
|
+
| IL | Israel | +972 |
|
|
219
|
+
| IT | Italy | +39 |
|
|
220
|
+
| JM | Jamaica | +1-876 |
|
|
221
|
+
| JP | Japan | +81 |
|
|
222
|
+
| JO | Jordan | +962 |
|
|
223
|
+
| KZ | Kazakhstan | +7 |
|
|
224
|
+
| KE | Kenya | +254 |
|
|
225
|
+
| KI | Kiribati | +686 |
|
|
226
|
+
| KP | North Korea | +850 |
|
|
227
|
+
| KR | South Korea | +82 |
|
|
228
|
+
| KW | Kuwait | +965 |
|
|
229
|
+
| KG | Kyrgyzstan | +996 |
|
|
230
|
+
| LA | Laos | +856 |
|
|
231
|
+
| LV | Latvia | +371 |
|
|
232
|
+
| LB | Lebanon | +961 |
|
|
233
|
+
| LS | Lesotho | +266 |
|
|
234
|
+
| LR | Liberia | +231 |
|
|
235
|
+
| LY | Libya | +218 |
|
|
236
|
+
| LI | Liechtenstein | +423 |
|
|
237
|
+
| LT | Lithuania | +370 |
|
|
238
|
+
| LU | Luxembourg | +352 |
|
|
239
|
+
| MO | Macau | +853 |
|
|
240
|
+
| MK | North Macedonia | +389 |
|
|
241
|
+
| MG | Madagascar | +261 |
|
|
242
|
+
| MW | Malawi | +265 |
|
|
243
|
+
| MY | Malaysia | +60 |
|
|
244
|
+
| MV | Maldives | +960 |
|
|
245
|
+
| ML | Mali | +223 |
|
|
246
|
+
| MT | Malta | +356 |
|
|
247
|
+
| MH | Marshall Islands | +692 |
|
|
248
|
+
| MQ | Martinique | +596 |
|
|
249
|
+
| MR | Mauritania | +222 |
|
|
250
|
+
| MU | Mauritius | +230 |
|
|
251
|
+
| YT | Mayotte | +269 |
|
|
252
|
+
| MX | Mexico | +52 |
|
|
253
|
+
| FM | Micronesia | +691 |
|
|
254
|
+
| MD | Moldova | +373 |
|
|
255
|
+
| MC | Monaco | +377 |
|
|
256
|
+
| MN | Mongolia | +976 |
|
|
257
|
+
| MS | Montserrat | +1-664 |
|
|
258
|
+
| MA | Morocco | +212 |
|
|
259
|
+
| MZ | Mozambique | +258 |
|
|
260
|
+
| MM | Myanmar | +95 |
|
|
261
|
+
| NA | Namibia | +264 |
|
|
262
|
+
| NR | Nauru | +674 |
|
|
263
|
+
| NP | Nepal | +977 |
|
|
264
|
+
| NL | Netherlands | +31 |
|
|
265
|
+
| AN | Netherlands Antilles | +599 |
|
|
266
|
+
| NC | New Caledonia | +687 |
|
|
267
|
+
| NZ | New Zealand | +64 |
|
|
268
|
+
| NI | Nicaragua | +505 |
|
|
269
|
+
| NE | Niger | +227 |
|
|
270
|
+
| NG | Nigeria | +234 |
|
|
271
|
+
| NU | Niue | +683 |
|
|
272
|
+
| NF | Norfolk Island | +672 |
|
|
273
|
+
| MP | Northern Mariana Islands | +1-670 |
|
|
274
|
+
| NO | Norway | +47 |
|
|
275
|
+
| OM | Oman | +968 |
|
|
276
|
+
| PK | Pakistan | +92 |
|
|
277
|
+
| PW | Palau | +680 |
|
|
278
|
+
| PS | Palestine | +970 |
|
|
279
|
+
| PA | Panama | +507 |
|
|
280
|
+
| PG | Papua New Guinea | +675 |
|
|
281
|
+
| PY | Paraguay | +595 |
|
|
282
|
+
| PE | Peru | +51 |
|
|
283
|
+
| PH | Philippines | +63 |
|
|
284
|
+
| PN | Pitcairn | +870 |
|
|
285
|
+
| PL | Poland | +48 |
|
|
286
|
+
| PT | Portugal | +351 |
|
|
287
|
+
| PR | Puerto Rico | +1-787 |
|
|
288
|
+
| QA | Qatar | +974 |
|
|
289
|
+
| RE | Reunion | +262 |
|
|
290
|
+
| RO | Romania | +40 |
|
|
291
|
+
| RU | Russia | +7 |
|
|
292
|
+
| RW | Rwanda | +250 |
|
|
293
|
+
| BL | Saint Barthelemy | +590 |
|
|
294
|
+
| SH | Saint Helena | +290 |
|
|
295
|
+
| KN | Saint Kitts and Nevis | +1-869 |
|
|
296
|
+
| LC | Saint Lucia | +1-758 |
|
|
297
|
+
| MF | Saint Martin | +590 |
|
|
298
|
+
| PM | Saint Pierre and Miquelon | +508 |
|
|
299
|
+
| VC | Saint Vincent and the Grenadines | +1-784 |
|
|
300
|
+
| WS | Samoa | +685 |
|
|
301
|
+
| SM | San Marino | +378 |
|
|
302
|
+
| ST | Sao Tome and Principe | +239 |
|
|
303
|
+
| SA | Saudi Arabia | +966 |
|
|
304
|
+
| SN | Senegal | +221 |
|
|
305
|
+
| SC | Seychelles | +248 |
|
|
306
|
+
| SL | Sierra Leone | +232 |
|
|
307
|
+
| SG | Singapore | +65 |
|
|
308
|
+
| SX | Sint Maarten | +1-721 |
|
|
309
|
+
| SK | Slovakia | +421 |
|
|
310
|
+
| SI | Slovenia | +386 |
|
|
311
|
+
| SB | Solomon Islands | +677 |
|
|
312
|
+
| SO | Somalia | +252 |
|
|
313
|
+
| ZA | South Africa | +27 |
|
|
314
|
+
| GS | South Georgia and the South Sandwich Islands | +500 |
|
|
315
|
+
| SS | South Sudan | +211 |
|
|
316
|
+
| ES | Spain | +34 |
|
|
317
|
+
| LK | Sri Lanka | +94 |
|
|
318
|
+
| SD | Sudan | +249 |
|
|
319
|
+
| SR | Suriname | +597 |
|
|
320
|
+
| SZ | Swaziland | +268 |
|
|
321
|
+
| SE | Sweden | +46 |
|
|
322
|
+
| CH | Switzerland | +41 |
|
|
323
|
+
| SY | Syria | +963 |
|
|
324
|
+
| TW | Taiwan | +886 |
|
|
325
|
+
| TJ | Tajikistan | +992 |
|
|
326
|
+
| TZ | Tanzania | +255 |
|
|
327
|
+
| TH | Thailand | +66 |
|
|
328
|
+
| TL | Timor-Leste | +670 |
|
|
329
|
+
| TG | Togo | +228 |
|
|
330
|
+
| TK | Tokelau | +690 |
|
|
331
|
+
| TO | Tonga | +676 |
|
|
332
|
+
| TT | Trinidad and Tobago | +1-868 |
|
|
333
|
+
| TN | Tunisia | +216 |
|
|
334
|
+
| TR | Turkey | +90 |
|
|
335
|
+
| TM | Turkmenistan | +993 |
|
|
336
|
+
| TV | Tuvalu | +688 |
|
|
337
|
+
| UG | Uganda | +256 |
|
|
338
|
+
| UA | Ukraine | +380 |
|
|
339
|
+
| AE | United Arab Emirates | +971 |
|
|
340
|
+
| GB | United Kingdom | +44 |
|
|
341
|
+
| US | United States | +1 |
|
|
342
|
+
| UY | Uruguay | +598 |
|
|
343
|
+
| UZ | Uzbekistan | +998 |
|
|
344
|
+
| VU | Vanuatu | +678 |
|
|
345
|
+
| VE | Venezuela | +58 |
|
|
346
|
+
| VN | Vietnam | +84 |
|
|
347
|
+
| VG | Virgin Islands (British) | +1-284 |
|
|
348
|
+
| VI | Virgin Islands (U.S.) | +1-340 |
|
|
349
|
+
| WF | Wallis and Futuna | +681 |
|
|
350
|
+
| EH | Western Sahara | +212 |
|
|
351
|
+
| YE | Yemen | +967 |
|
|
352
|
+
| ZM | Zambia | +260 |
|
|
353
|
+
| ZW | Zimbabwe | +263 |
|
|
354
|
+
|
|
355
|
+
## Authors
|
|
356
|
+
|
|
357
|
+
For any questions or issues, please contact:
|
|
358
|
+
|
|
359
|
+
* **Author** : [Suhail Shaji](https://github.com/suhailshaji)
|
|
360
|
+
* **Email** : [suhailshaji@gmail.com]()
|
|
361
|
+
|
|
362
|
+
## Feedback
|
|
363
|
+
|
|
364
|
+
If you have any feedback, please reach out to us at
|
|
365
|
+
suhailshaji@gmail.com
|
|
366
|
+
|
|
367
|
+
## License
|
|
368
|
+
|
|
369
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
370
|
+
|
|
371
|
+
## 🔗 Connect
|
|
372
|
+
|
|
373
|
+
[](https://www.linkedin.com/suhailshaji)
|
|
374
|
+
|
|
375
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
genkit/__init__.py,sha256=l40QPuo7IG96TFkFGupBGwV4XjS1NX-JZ4vr6GzBgWU,26
|
|
2
|
+
genkit/country_code.py,sha256=Tlp94wmrGkEt2Oz3odYCfopve-ItKWiUkgUcSYso21Q,7628
|
|
3
|
+
genkit/genkit.py,sha256=I82sqxZvIPXrplR0qzPPbLsthqIxgTzknn4VuO06AM8,2863
|
|
4
|
+
genkit-0.1.0.dist-info/LICENSE,sha256=7fg8IyaKRt8QJS19qwvfN13YpyH-HBJLufXMazb1cE4,1101
|
|
5
|
+
genkit-0.1.0.dist-info/METADATA,sha256=LTO9ZrBODphg4szyttyBq1cZP68OwhrBmJiJrcxVPX4,21763
|
|
6
|
+
genkit-0.1.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
7
|
+
genkit-0.1.0.dist-info/top_level.txt,sha256=Tp1BCiorPrmvzyKs2govu5aAr0M4FI0LDJHKb8jPB60,7
|
|
8
|
+
genkit-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
genkit
|