SDK/Library version: 1.13.1
Environment: Sandbox
PayPal-Debug-ID values: None
Language, the language version, and OS: Python, Ubuntu
Issue description:
I'm getting the following error when I try to cancel a billing agreement.
The error:
TypeError: cancel() missing 1 required positional argument: 'attributes'
My code:
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel():
print(billing_agreement)
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
I'm getting the error because I need something in the attribute's value but I don't know what should I assign to the variable.
GitHub issue: https://github.com/paypal/PayPal-Python-SDK/issues/297
After some digging and looking at the documentation samples I found a sample about the cancel option and what I needed to assign to the attribute value was a cancel_note.
The code:
cancel_note = {"note": "Canceling the agreement"}
user = Users.query.filter_by(id=ID).first()
billing_id = Subscriptions.query.filter_by(email=user.email).filter_by(active=1).first().order_id
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel(cancel_note):
flash('Subscription canceled with success.', 'success')
return redirect(url_for('settings.settingspage'))
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
The documentation sample
Related
I am trying to use the biomaRt package to access the data from Ensembl, however I got error message when using the useDataset() function. My codes are shown below.
library(httr)
listMarts()
ensembl = useMart("ENSEMBL_MART_ENSEMBL")
listDatasets(ensemble)
ensembl = useDataset("hsapiens_gene_ensembl",mart = ensemble)
When I type useDataset function i got error message like this:
> ensembl = useDataset("hsapiens_gene_ensembl",mart = ensembl)
Ensembl site unresponsive, trying asia mirror
Error in textConnection(text, encoding = "UTF-8") :
invalid 'text' argument
and sometimes another different error message showed as:
> ensembl = useDataset("hsapiens_gene_ensembl",mart = ensembl)
Ensembl site unresponsive, trying asia mirror
Error in textConnection(bmResult) : invalid 'text' argument
it seems like that the mirror automatically change to asia OR useast OR uswest, but the error message still shows up over and over again, and i don't know what to do.
So if anyone could help me with this? I will be very grateful for any help or suggestion.
Kind regards Riley Qiu, Dongguan, China
I'd like to compute the travel time between two points. So I use the RoutingApi from herepy library (as reported in the example at https://github.com/abdullahselek/HerePy/blob/master/examples/routing_api.py):
from herepy import (
RoutingApi,
RouteMode,
MatrixRoutingType,
MatrixSummaryAttribute,
RoutingTransportMode,
RoutingMode,
RoutingApiReturnField,
RoutingMetric,
RoutingApiSpanField,
AvoidArea,
AvoidFeature,
Avoid,
Truck,
ShippedHazardousGood,
TunnelCategory,
TruckType,
)
routing_api = RoutingApi(api_key="my_key")
response = routing_api.truck_route(
waypoint_a=[lat_a, lon_a],
waypoint_b=[lat_b, lon_b],
modes=[RouteMode.truck, RouteMode.fastest],
)
print(response.as_dict())
Though, even if my api key is valid and "enabled" on the HERE developer platform, I get the following error message:
HEREError: Error occurred on routing_api __get _route response status code 403
Can anyone explain to me why is this happening and how to solve that? Thank you in advance.
The issue is with coordinates.
Looking at the example at https://github.com/abdullahselek/HerePy/blob/master/examples/routing_api.py
if you try:
response = routing.car_route(waypoint_a=[41.9798, -87.8801], waypoint_b=[41.9043, -87.9216], modes=[herepy.RouteMode.car, herepy.RouteMode.fastest])
print(response.as_dict())
it should work.
I'm making a function in my e-commerce website which updates credentials of a user. whenever my form triggers this function I get the error -> sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type boolean: "sdzf"
I'm unable to find out what's wrong. Please help me find the issue. Thanks in advance.
python code:
#app.route("/admin_cred_update", methods=["POST","GET"])
def admin_cred_update():
email=str(request.form.get("email"))
password=str(request.form.get("password"))
if re.search("[.,*/%$#:|\[\]\(\)]",email) and re.search("[.,*/%$#:|\[\]\(\)]",password):
message="there are some invalid characters in above fields"
return render_template("admin_profile.html", updatemes=message)
else:
db.execute("update admin_master_tbl SET email=:email and password=:password where email=:smail and password=:spassword",{"email":email,"password":password,"smail":session["adminname"],"spassword":session["adminpassword"]})
session["adminname"]=email
session["adminpassword"]=password
message1="credentials updated succesfully"
return render_template("admin_profile.html", updatemes=message1)
error log:
sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type boolean: "sdzf"
LINE 1: update admin_master_tbl SET email='sdzf' and password='csadf...
^
[SQL: update admin_master_tbl SET email=%(email)s and password=%(password)s where email=%(smail)s and password=%(spassword)s]
[parameters: {'email': 'sdzf', 'password': 'csadfc', 'smail': 'lightningdrago72#gmail.com', 'spassword': 'asdf'}]
Oh I found the problem!!. I did the mistake of putting and instead of , in the SET part of my query. Now the problem is solved!!.
I am following the documentation to acquire a lock on a variable but it fails:
a = 0
lock(a) do
a += 1
end
Error message:
ERROR: MethodError: no method matching lock(::var"#3#4", ::Int64)
Closest candidates are:
lock(::Any, ::Base.GenericCondition) at condition.jl:78
lock(::Any, ::Base.AbstractLock) at lock.jl:158
lock(::Any, ::WeakKeyDict) at weakkeydict.jl:76
Stacktrace:
[1] top-level scope at REPL[3]:1
The error message is clear but why would the code provided in the documentation fail. Moreover, not sure where to look for the detailed documentation about the lock function.
OK, I figured it out:
a = 0
l = ReentrantLock()
lock(l) do
global a # Needed if using REPL
a += 1
end
I'm trying to get a command return with selenium ide by doing it :
storeTextPresent|myText|title
gotoIf|storedVars.tite|true
echo|${"true"}
but it doesnt work...i have : [error] Unexpected Exception: fileName -> chrome://flowcontrol/content/extensions/goto-sel-ide.js?1347871647495, lineNumber -> 120.
Does anybody know how to get the return?
Thank you
I didn't check for boolean support on gotoIf, but if gotoIf wants to go to a label, I don't see a label defined in the above script.
Also, the "storedVars.tite" reference looks to be misspelled.