-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsentry_error.py
More file actions
197 lines (184 loc) · 4.26 KB
/
sentry_error.py
File metadata and controls
197 lines (184 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import time
import sentry_sdk
# sentry_sdk.init("http://7006ac3054e447f49e398aea16c0f8ed@10.150.27.209:9000/4")
sentry_sdk.init("http://b7e535516d724bbba9a2dbb3edf0c80e@10.150.27.209:9000/3")
# sentry_sdk.init("http://88d4eb4e4d9d4547a5ea97e18ccbef04@10.150.27.209:9000/sentry//2", traces_sample_rate=1.0)
division_by_zero = 1 / 0
'end'
if False:
# from geoip import geolite2
# import geoip
# geoip2 = geoip.geolite2
import geoip2.database
#reader = geoip2.database.Reader('~/GeoLite2/GeoLite2-City.mmdb')
reader = geoip2.database.Reader('/Users/BEJ-NB-2077/GeoLite2/GeoLite2-City.mmdb')
# response = reader.city('128.101.101.101')
# response = reader.city('219.142.140.226')
response = reader.city('175.4.79.187')
print(response)
print(response.country.name)
print(response.country.names['zh-CN'])
print(response.traits.network)
#line = geolite2.lookup('219.142.140.226'.encode('utf-8'))
reader.close()
#
#
#
#
# from multiprocessing import Process
# import os
#
# def info(title):
# print(title)
# print('module name:', __name__)
# print('parent process:', os.getppid())
# print('process id:', os.getpid())
#
# def f(name):
# info('function f')
# print('hello', name)
#
# if __name__ == '__main__':
# info('main line')
# p = Process(target=f, args=('bob',))
# p.start()
# p.join()
#
# class Node:
# data = None
# next = None
#
#
# def create_link_list(node_arr):
# head_node = None
# next_node = None
# for i in node_arr:
# node = Node()
# node.data = i
# node.next = None
# if head_node is None:
# head_node = node
# next_node = head_node
# else:
# next_node.next = node
# next_node = node
#
# return head_node
#
#
# def print_link_list(head):
# _list = []
# while head is not None:
# # print(head.data)
# _list.append(head.data)
# head = head.next
# print(_list)
#
#
# def reverse1(head):
# if head is None or head.next is None:
# return head
# current = head
# pre = None
# pnext = None
# while current is not None:
# pnext = current.next
# current.next = pre
# pre = current
# current = pnext
#
# return pre
#
#
# def reverse2(current):
# if current.next is None:
# return current
# pnext = current.next
# current.next = None
# reversed = reverse2(pnext)
# pnext.next = current
#
# return reversed
#
#
# def reverse3(current, pre):
# if current.next is None:
# current.next = pre
# return current
# else:
# pnext = current.next
# current.next = pre
# return reverse3(pnext, current)
#
#
# if __name__ == '__main__':
# head = create_link_list([1, 2, 3, 4, 5])
# print_link_list(head) # 输出,[1,2,3,4,5, ...]
#
# # 求写一段代码(例如以下示例代码)实现将以上 head 反转,并且最终输出结果如下
# def reverse_link(head):
# pass
#
# new_head = reverse_link(head)
# print_link_list(new_head) # 输出 [5, 4, 3, 2, 1]
#
#
#
#
#
# # import copy
# #
# # l1 = [1, 2, [3, 4]]
# # l2 = copy.copy(l1)
# # l1.append(5)
# # l1[2].append(5) # 子对象 改变
# # print(l1)
# # print(l2)
# # [1, 2, [3, 4, 5], 5]
# # [1, 2, [3, 4, 5]]
#
#
# class Obj:
# def __init__(self):
# pass
#
# def __new__(cls, *args, **kwargs):
# if not hasattr(Obj, "_instance"): # 反射
# Obj._instance = object.__new__(cls)
# return Obj._instance
#
# obj1 = Obj()
# obj2 = Obj()
#
# print(obj1 is obj2) # 要求输出结果为 True
#
# import copy
#
# a = ['a', 'b', 'c', [0, 1, 2], 'd']
# b = a
# c = copy.copy(a)
# d = copy.deepcopy(a)
#
# a.append('e')
# a[3].append(3)
#
# print(a)
# print(b)
# print(c)
# print(d)
#
#
#
# def fn(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10):
# print(arg1)
# print(arg2)
# print(arg3)
# print(arg4)
# print(arg5)
# print(arg6)
# print(arg7)
# print(arg8)
# print(arg9)
# print(arg10)
#
# fn(1, 2, 3, 4, a=1, b=2,)