text stringlengths 0 828 |
|---|
data = { |
'login_token': self.login_token, |
'format': ""json"", |
'domain_id': self.domain_id, |
'record_id': self.record_id, |
'sub_domain': self.sub_domain, |
'record_line': '默认', |
'value': ip |
} |
res = requests.post(Ddns.DNSPOD_API, data, headers=headers) |
logger.debug(res.json()) |
return res.json()['status']['code'] == '1'" |
1789,"def post(self, path, data={}): |
'''Perform POST Request ''' |
response = requests.post(API_URL + path, data=json.dumps(data), headers=self._set_headers()) |
return self._check_response(response, self.post, path, data)" |
1790,"def delete(self, path, data={}): |
'''Perform DELETE Request''' |
if len(data) != 0: |
parameter_string = '' |
for k,v in data.items(): |
parameter_string += '{}={}'.format(k,v) |
parameter_string += '&' |
path += '?' + parameter_string |
response = requests.delete(API_URL + path, headers=self._set_headers()) |
return self._check_response(response, self.delete, path, data)" |
1791,"def parsed(self): |
""""""Get the ConfigParser object which represents the content. |
This property is cached and only parses the content once. |
"""""" |
if not self._parsed: |
self._parsed = ConfigParser() |
self._parsed.readfp(io.StringIO(self.content)) |
return self._parsed" |
1792,"def create_cache(directory, compress_level=6, value_type_is_binary=False, **kwargs): |
"""""" |
Create a html cache. Html string will be automatically compressed. |
:param directory: path for the cache directory. |
:param compress_level: 0 ~ 9, 9 is slowest and smallest. |
:param kwargs: other arguments. |
:return: a `diskcache.Cache()` |
"""""" |
cache = diskcache.Cache( |
directory, |
disk=CompressedDisk, |
disk_compress_level=compress_level, |
disk_value_type_is_binary=value_type_is_binary, |
**kwargs |
) |
return cache" |
1793,"def timeticks(tdiff): |
"""""" |
NOTE do NOT use ""interval"" or ticks are misaligned! use ""bysecond"" only! |
"""""" |
if isinstance(tdiff, xarray.DataArray): # len==1 |
tdiff = timedelta(seconds=tdiff.values / np.timedelta64(1, 's')) |
assert isinstance(tdiff, timedelta), 'expecting datetime.timedelta' |
if tdiff > timedelta(hours=2): |
return None, None |
elif tdiff > timedelta(minutes=20): |
return MinuteLocator(byminute=range(0, 60, 5)), MinuteLocator(byminute=range(0, 60, 2)) |
elif (timedelta(minutes=10) < tdiff) & (tdiff <= timedelta(minutes=20)): |
return MinuteLocator(byminute=range(0, 60, 2)), MinuteLocator(byminute=range(0, 60, 1)) |
elif (timedelta(minutes=5) < tdiff) & (tdiff <= timedelta(minutes=10)): |
return MinuteLocator(byminute=range(0, 60, 1)), SecondLocator(bysecond=range(0, 60, 30)) |
elif (timedelta(minutes=1) < tdiff) & (tdiff <= timedelta(minutes=5)): |
return SecondLocator(bysecond=range(0, 60, 30)), SecondLocator(bysecond=range(0, 60, 10)) |
elif (timedelta(seconds=30) < tdiff) & (tdiff <= timedelta(minutes=1)): |
return SecondLocator(bysecond=range(0, 60, 10)), SecondLocator(bysecond=range(0, 60, 2)) |
else: |
return SecondLocator(bysecond=range(0, 60, 2)), SecondLocator(bysecond=range(0, 60, 1))" |
1794,"def cli(ctx, bubble_home, config, verbose, barverbose, profile): |
""""""Bubble: command line tool for bubbling information between services |
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.\n |
Making single point to point API connections:\n |
_________________>>>>>>>>>pump>>>>>>>>>>>>>_____________________\n |
(source-service)->pull->(transform)->push->(target-service)\n |
_________________>>>>>>>>>pump>>>>>>>>>>>>>_____________________\n |
bubble can:\n |
* pull data from the source client\n |
* transform the data with flexible mapping and filtering rules\n |
* rules can use (custom) rule functions\n |
* push the result to the target client\n |
A Bubble can process a list of basic python dicts(LOD), |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.