I am dealing with the following error
Traceback (most recent call last):
File "once.py", line 1757, in <module>
once()
File "once.py", line 55, in once
stripe.Charge.all()
File "/Library/Python/2.7/site-packages/stripe/resource.py", line 438, in all
return cls.list(*args, **params)
File "/Library/Python/2.7/site-packages/stripe/resource.py", line 450, in list
response, api_key = requestor.request('get', url, params)
File "/Library/Python/2.7/site-packages/stripe/api_requestor.py", line 150, in request
method.lower(), url, params, headers)
File "/Library/Python/2.7/site-packages/stripe/api_requestor.py", line 281, in request_raw
method, abs_url, headers, post_data)
File "/Library/Python/2.7/site-packages/stripe/http_client.py", line 139, in request
self._handle_request_error(e)
File "/Library/Python/2.7/site-packages/stripe/http_client.py", line 159, in _handle_request_error
raise error.APIConnectionError(msg)
stripe.error.APIConnectionError: Unexpected error communicating with Stripe. If this problem persists,
let us know at support#stripe.com.
I get this error when running a simple test program which stripe suggested
import stripe
stripe.api_key = "blah bla"
stripe.api_base = "https://api-tls12.stripe.com"
print "stripe.VERSION = ", stripe.VERSION
if stripe.VERSION in ("1.13.0", "1.14.0", "1.14.1", "1.15.1", "1.16.0", "1.17.0", "1.18.0", "1.19.0"):
print "Bindings update required."
try:
stripe.Charge.all()
print "TLS 1.2 supported, no action required."
except stripe.error.APIConnectionError:
print "TLS 1.2 is not supported. You will need to upgrade your integration."
raise
I do not understand why I get this error, since my stripe version is high enough
stripe.VERSION = 1.55.2
and my openssl version does support TLS?
>>$ openssl version
OpenSSL 1.0.2k 26 Jan 2017
>>$ which openssl
/usr/bin/openssl
any ideas how to debug this further? I am lost...
ok I don't know what exactly caused the problem, but I got it working by changing the client
client = stripe.http_client.PycurlClient()
stripe.default_http_client = client
I think the requests package is the default. pycurl seems to work in my case...
Related
I'm trying to use the ansible strategy mitogen_linear. Once I try to run a playbook with more then one maschine its crashes as follows.
I'm running this on a Debian 11 over WSL v2 with kernel version 5.10.102.1.
ERROR! [mux 12903] 17:51:03.129739 E mitogen: <Stream ssh.proxyserver02 #5730> crashed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/mitogen/core.py", line 3488, in _call
func(self)
File "/usr/lib/python3/dist-packages/mitogen/core.py", line 1726, in on_transmit
self.protocol.on_transmit(broker)
File "/usr/lib/python3/dist-packages/mitogen/core.py", line 2174, in on_transmit
self._writer.on_transmit(broker)
File "/usr/lib/python3/dist-packages/mitogen/core.py", line 1914, in on_transmit
written = self._protocol.stream.transmit_side.write(buf)
File "/usr/lib/python3/dist-packages/mitogen/core.py", line 2040, in write
written, disconnected = io_op(os.write, self.fd, s)
File "/usr/lib/python3/dist-packages/mitogen/core.py", line 553, in io_op
return func(*args), None
BlockingIOError: [Errno 11] Resource temporarily unavailable
fatal: [proxyserver02]: UNREACHABLE! => changed=false
msg: Channel was disconnected while connection attempt was in progress; this may be caused by an abnormal Ansible exit, or due to an unreliable target.
unreachable: true
I see that several Python-package related files have gibberish at their end.
Due to this, I am unable to do several pip operations (even basic ones like "pip list").
(Usually, I use conda by the way)
For example. When I pressed pip list. I get the following error.
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\commands\list.py", line 179, in run
self.output_package_listing(packages, options)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\commands\list.py", line 255, in output_package_listing
data, header = format_for_columns(packages, options)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\commands\list.py", line 307, in format_for_columns
row = [proj.raw_name, str(proj.version)]
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\metadata\base.py", line 163, in raw_name
return self.metadata.get("Name", self.canonical_name)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\metadata\pkg_resources.py", line 96, in metadata
return get_metadata(self._dist)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_internal\utils\packaging.py", line 48, in get_metadata
metadata = dist.get_metadata(metadata_name)
File "C:\Users\shan_jaffry\Miniconda3\envs\SQL_version\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1424, in get_metadata
return value.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 14097: invalid start byte in METADATA file at path: c:\users\shan_jaffry\miniconda3\envs\sql_version\lib\site-packages\hupper-1.10.2.dist-info\METADATA
I went into the file META and found the following gibberish at the end. This (I found) has been done in several other files i.e. end of files are appended with gibberish and the actual thin is removed. Any help?
> 0.1 (2016-10-21)
> ================
> -
> - Initial rele9ýl·øA
I found that the by manually going to the site-packages folder, and removing the two folders, :: hupper and hupper-1.10.2.dist-info and then installing hupper again using "pip install hupper", problem was solved.
The issue was that the hupper package (and hupper-1.10.2.dist-info) were corrupted. Hence uninstall and re-install helped.
I am new to Python.
I have this code in Python:
from netmiko import ConnectHandler
`sshCli = ConnectHandler(
device_type='Cisco_ios',
host='192.168.56.101',
port=22,
username='cisco',
password='cisco123!'
)
output = sshCli.send_command("show ip int brief")
print("show ip int brief:\n{}\n".format(output))
I get the following error:
========== RESTART: C:/Users/edanpc/AppData/Local/Programs/Python/Python38-32/Lab2.2.py =========
Traceback (most recent call last):
File "C:/Users/edanpc/AppData/Local/Programs/Python/Python38-32/Lab2.2.py", line 2, in <module>
sshCli = ConnectHandler(
File "C:\Users\edanpc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\netmiko\ssh_dispatcher.py", line 297, in ConnectHandler
raise ValueError(
ValueError: Unsupported 'device_type' currently supported platforms are:
a10
accedian
adtran_os
alcatel_aos
alcatel_sros
apresia_aeos
arista_eos
aruba_os
avaya_ers
avaya_vsp
broadcom_icos
brocade_fastiron
brocade_netiron
brocade_nos
brocade_vdx
brocade_vyos
calix_b6
centec_os
checkpoint_gaia
ciena_saos
cisco_asa
cisco_ios
cisco_nxos
cisco_s300
cisco_tp
cisco_wlc
cisco_xe
cisco_xr
cloudgenix_ion
coriant
dell_dnos9
dell_force10
dell_isilon
dell_os10
dell_os6
dell_os9
dell_powerconnect
dlink_ds
eltex
eltex_esr
endace
enterasys
extreme
extreme_ers
extreme_exos
extreme_netiron
extreme_nos
extreme_slx
extreme_vdx
extreme_vsp
extreme_wing
f5_linux
f5_ltm
f5_tmsh
flexvnf
fortinet
generic
generic_termserver
hp_comware
hp_procurve
huawei
huawei_olt
huawei_smartax
huawei_vrpv8
ipinfusion_ocnos
juniper
juniper_junos
juniper_screenos
keymile
keymile_nos
linux
mellanox
mellanox_mlnxos
mikrotik_routeros
mikrotik_switchos
mrv_lx
mrv_optiswitch
netapp_cdot
netgear_prosafe
netscaler
nokia_sros
oneaccess_oneos
ovs_linux
paloalto_panos
pluribus
quanta_mesh
rad_etx
raisecom_roap
ruckus_fastiron
ruijie_os
sixwind_os
sophos_sfos
ubiquiti_edge
ubiquiti_edgeswitch
ubiquiti_unifiswitch
vyatta_vyos
vyos
watchguard_fireware
yamaha
zte_zxros
>>>
What is wrong with my code ?
This error is specific to netmiko. The error text says the list of supported device_type values. To solve the error, fix the below in your code.
device_type='cisco_ios'
The device type should contain small cisco_ios instead of Cisco_ios.
I'm running a Dataflow job which I think should work, and is failing after 1.5 hrs with what looks like network errors. It works fine when run against a subset of the data.
The first trouble sign is a whole string of warnings like this:
Refusing to split <dataflow_worker.shuffle.GroupedShuffleRangeTracker object at 0x7f2bcb629950> at b'\xa4r\xa6\x85\x00\x01': proposed split position is out of range [b'\xa4^E\xd2\x00\x01', b'\xa4r\xa6\x85\x00\x01'). Position of last group processed was b'\xa4r\xa6\x84\x00\x01'.
Then there are four errors which seem to be about writing CSV files to GCS:
Error in _start_upload while inserting file gs://(redacted).csv: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/gcsio.py", line 565, in _start_upload self._client.objects.Insert(self._insert_request, upload=self._upload) File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/internal/clients/storage/storage_v1_client.py", line 1156, in Insert upload=upload, upload_config=upload_config) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 731, in _RunMethod return self.ProcessHttpResponse(method_config, http_response, request) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 737, in ProcessHttpResponse self.__ProcessHttpResponse(method_config, http_response, request)) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 604, in __ProcessHttpResponse http_response, method_config=method_config, request=request) apitools.base.py.exceptions.HttpError: HttpError accessing <https://www.googleapis.com/resumable/upload/storage/v1/b/(redacted).csv&uploadType=resumable&upload_id=(redacted)>: response: <{'content-type': 'text/plain; charset=utf-8', 'x-guploader-uploadid': '(redacted)', 'content-length': '0', 'date': 'Wed, 08 Jul 2020 22:17:28 GMT', 'server': 'UploadServer', 'status': '503'}>, content <>
Error in _start_upload while inserting file gs://(redacted).csv: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/gcsio.py", line 565, in _start_upload self._client.objects.Insert(self._insert_request, upload=self._upload) File "/usr/local/lib/python3.7/site-packages/apache_beam/io/gcp/internal/clients/storage/storage_v1_client.py", line 1156, in Insert upload=upload, upload_config=upload_config) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/base_api.py", line 715, in _RunMethod http_request, client=self.client) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 908, in InitializeUpload return self.StreamInChunks() File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 1020, in StreamInChunks additional_headers=additional_headers) File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 971, in __StreamMedia self.RefreshResumableUploadState() File "/usr/local/lib/python3.7/site-packages/apitools/base/py/transfer.py", line 873, in RefreshResumableUploadState self.stream.seek(self.progress) File "/usr/local/lib/python3.7/site-packages/apache_beam/io/filesystemio.py", line 301, in seek offset, whence, self.position, self.last_block_position)) NotImplementedError: offset: 0, whence: 0, position: 411, last: 411
The Dataflow job ID is 2020-07-07_13_08_31-7649894576933400587 -- if anyone from Google Cloud Support is able to look at this I'd be very grateful. Thanks very much.
P.S I asked a similar question last year (Dataflow job fails at BigQuery write with backend errors), the resolution was to use --experiments=use_beam_bq_sink -- I am already doing this.
You can safely ignore "Refusing to split" errors. This just means that the split position Dataflow service provided probably was received by the worker after that position was already read by the worker. Hence the worker has to ignore the split request.
Error "Error in _start_upload while inserting" seems more problematic and seems to be similar to https://issues.apache.org/jira/browse/BEAM-7014. I suspect this to be a rare flake though so I'm not sure if this was the reason for your job failure (the job only fails of the same workitem failed four times).
Can you contact Google Cloud support so that they can look into your job ?
I will mention this in the JIRA.
I was looking for pinterest API endpoints...
I've founded some URL..
https://api.pinterest.com/v3/domains/<domains>/search/pins/?query=<query>&access_token=<access_token>
I was able to generate the access_token..but every time I've tried a POST on that URL it gave me:
{
"status":"failure",
"code":12,
"host":"ngapi2-b2fc674c",
"generated_at":"Mon, 09 Feb 2015 17:45:29 +0000",
"message":"Something went wrong on our end. Sorry about that.",
"data":"path: /v3/domains/www.vtracker.com.br/search/pins/\nparams:
[('access_token', [u'blablahblahblah']), ('query',
[u'como'])]\nTraceback (most recent call last):\n File
\"/mnt/virtualenv/local/lib/python2.7/site-packages/flask/app.py\",
line 1504, in wsgi_app\n response =
self.full_dispatch_request()\n File
\"/mnt/virtualenv/local/lib/python2.7/site-packages/flask/app.py\",
line 1264, in full_dispatch_request\n rv =
self.handle_user_exception(e)\n File
\"/mnt/virtualenv/local/lib/python2.7/site-packages/flask/app.py\",
line 1262, in full_dispatch_request\n rv =
self.dispatch_request()\n File
\"/mnt/virtualenv/local/lib/python2.7/site-packages/flask/app.py\",
line 1248, in dispatch_request\n return
self.view_functions[rule.endpoint](**req.view_args)\n File
\"../api/pin_api.py\", line 715, in __call__\n
self._perform_auth()\n File \"../api/pin_api.py\", line 848, in
_perform_auth\n authorization.perform(dictified_values,
request.cookies, request.headers)\n File \"../api/pin_api.py\",
line 271, in perform\n params, cookies, headers)\n File
\"../api/pin_api.py\", line 121, in perform\n headers=headers)\n
File \"../api/decorators.py\", line 212, in
verify_user_authorization\n
core.Consumer.manager.get_scope_as_int(required_scope)):\n File
\"../core/managers/consumer_manager.py\", line 479, in
check_scope\n scope = migrate_legacy_scope(scope)\n File
\"../core/managers/consumer_manager.py\", line 475, in
migrate_legacy_scope\n if ~scope & old == 0:\nTypeError: bad
operand type for unary ~: 'NoneType'\n"
}
Is Pinterest API v3 closed or some other problem is going on?
Thks
You must first ensure that your app has been approved by Pinterest. You may need to reapply for approval (I had to reapply for my app). Once you are approved, you will see a link on your app page called "Visit API docs". This will link to the V3 documentation (https://developers.pinterest.com/docs/redoc/pinner_app). At least, this is the documentation I have been given access to. If you have a different type of app, maybe you will have access to other documentation.
After your app has been approved, the section of the documentation you will be interested in is "Search user pins" (https://developers.pinterest.com/docs/redoc/pinner_app/#tag/search).
The endpoint is: https://api.pinterest.com/v3/search/user_pins/{user}/
The documentation provides details about the query parameters that are allowed and the response data.